code: def replica_set_link(rel, repl_id=None, member_id=None, self_rel=False):
      
      repls_href = '/v1/replica_sets'
      link = _REPLICA_SET_LINKS[rel].copy()
      link['href'] = link['href'].format(**locals())
      link['rel'] = 'self' if self_rel else rel
      return link
docs: Helper for getting a ReplicaSet link document, given a rel.