def base_link(rel, self_rel=False):
    """Helper for getting a link document under the API root, given a rel."""
    link = _BASE_LINKS[rel].copy()
    link['rel'] = 'self' if self_rel else rel
    return link