def format_citations(zid, url='<STR_LIT>', hits=<NUM_LIT:10>, tag_prefix='<STR_LIT:v>'):
<EOL>url = ('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(id=zid, url=url, hits=hits))<EOL>metadata = requests.get(url).json()<EOL>lines = []<EOL>for i, hit in enumerate(metadata['<STR_LIT>']['<STR_LIT>']):<EOL><INDENT>version = hit['<STR_LIT>']['<STR_LIT:version>'][len(tag_prefix):]<EOL>lines.append('<STR_LIT:->' * len(version))<EOL>lines.append(version)<EOL>lines.append('<STR_LIT:->' * len(version))<EOL>lines.append('<STR_LIT>')<EOL>lines.append('<STR_LIT>'<EOL>'<STR_LIT>'.format(**hit['<STR_LIT>']))<EOL>if i < hits - <NUM_LIT:1>:<EOL><INDENT>lines.append('<STR_LIT>')<EOL><DEDENT><DEDENT>return '<STR_LIT:\n>'.join(lines)<EOL>
Query and format a citations page from Zenodo entries

    Parameters
    ----------
    zid : `int`, `str`
        the Zenodo ID of the target record

    url : `str`, optional
        the base URL of the Zenodo host, defaults to ``https://zenodo.org``

    hist : `int`, optional
        the maximum number of hits to show, default: ``10``

    tag_prefix : `str`, optional
        the prefix for git tags. This is removed to generate the section
        headers in the output RST

    Returns
    -------
    rst : `str`
        an RST-formatted string of DOI badges with URLs