Influence of length and flexibility of spacers on the binding affinity of divalent ligands