def number_of_mmols(code):
    """ Number of .mmol files associated with code in the PDBE.

    Notes
    -----
    This function makes a series of calls to the PDBE website using the requests module. This can make it slow!

    Parameters
    ----------
    code : str
        PDB code.

    Returns
    -------
    num_mmols : int

    Raises
    ------
    ValueError
        If no .mmol files are found at all.
        Could be due to erroneous input argument, or a problem with connecting to the PDBE.
    """
    # If num_mmols is already known, return it
    if mmols_numbers:
        if code in mmols_numbers.keys():
            mmol = mmols_numbers[code][0]
            return mmol
    counter = 1
    while True:
        pdbe_url = "http://www.ebi.ac.uk/pdbe/static/entry/download/{0}-assembly-{1}.cif.gz".format(code, counter)
        r = requests.get(pdbe_url)
        if r.status_code == 200:
            counter += 1
        else:
            break
    if counter == 1:
        while True:
            pdb_url = "http://www.rcsb.org/pdb/files/{0}.pdb{1}.gz".format(code.upper(), counter)
            r = requests.get(pdb_url)
            if r.status_code == 200 and r.encoding is None:
                counter += 1
            else:
                break
    if counter == 1:
        pdb_url = "http://files.rcsb.org/download/{0}.pdb".format(code.upper())
        r = requests.get(pdb_url)
        if r.status_code == 200:
            counter += 1
    num_mmols = counter - 1
    if num_mmols == 0:
        raise ValueError('Could not access ANY .mmol files for {0}'.format(code))
    return num_mmols
Number of .mmol files associated with code in the PDBE.

    Notes
    -----
    This function makes a series of calls to the PDBE website using the requests module. This can make it slow!

    Parameters
    ----------
    code : str
        PDB code.

    Returns
    -------
    num_mmols : int

    Raises
    ------
    ValueError
        If no .mmol files are found at all.
        Could be due to erroneous input argument, or a problem with connecting to the PDBE.