<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate(mnx_dump):
 """ Annotate a shortlist of metabolites with cross-references using MetaNetX. MNX_DUMP : The chemicals dump from MetaNetX usually called 'chem_xref.tsv'. Will be downloaded if it doesn't exist. """

    LOGGER.info("Read shortlist.")
    targets = pd.read_table(join(dirname(__file__), "shortlist.tsv"))
    if not exists(mnx_dump):
        # Download the MetaNetX chemicals dump if it doesn't exists.
        # Download done as per https://stackoverflow.com/a/16696317.
        LOGGER.info("MetaNetX dump '%s' does not exist. Downloading...",
                    mnx_dump)
        with open(mnx_dump, "wb") as file_handle, \
            get("https://www.metanetx.org/cgi-bin/mnxget/mnxref/chem_xref.tsv",
                stream=True) as stream:
            for chunk in stream.iter_content(chunk_size=1024):
                file_handle.write(chunk)
        LOGGER.info("Done.")
    LOGGER.info("Read the MetaNetX dump with cross-references.")
    db = pd.read_table(mnx_dump, comment='#',
                       names=['XREF', 'MNX_ID', 'Evidence', 'Description'])
    LOGGER.info("Generate the shortlist cross-references.")
    res = generate_shortlist(db, targets)
    LOGGER.info("Save result.")
    res.to_json(join(dirname(__file__), pardir, "memote", "support", "data",
                     "met_id_shortlist.json"), force_ascii=False)