<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replica_set_link(rel, repl_id=None, member_id=None, self_rel=False):
 """Helper for getting a ReplicaSet link document, given a rel."""

    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