Get dictionary of information relating to a new amino acid code not currently in the database.

    Notes
    -----
    Use this function to get a dictionary that is then to be sent to the function add_amino_acid_to_json().
    use to fill in rows of amino_acid table for new amino acid code.

    Parameters
    ----------
    code : str
        Three-letter amino acid code.

    Raises
    ------
    IOError
        If unable to locate the page associated with the amino acid name on the PDBE site.

    Returns
    -------
    aa_dict : dict
        Keys are AminoAcidDB field names.
        Values are the str values for the new amino acid, scraped from the PDBE if possible. None if not found.

def get_aa_info(code):
    """Get dictionary of information relating to a new amino acid code not currently in the database.

    Notes
    -----
    Use this function to get a dictionary that is then to be sent to the function add_amino_acid_to_json().
    use to fill in rows of amino_acid table for new amino acid code.

    Parameters
    ----------
    code : str
        Three-letter amino acid code.

    Raises
    ------
    IOError
        If unable to locate the page associated with the amino acid name on the PDBE site.

    Returns
    -------
    aa_dict : dict
        Keys are AminoAcidDB field names.
        Values are the str values for the new amino acid, scraped from the PDBE if possible. None if not found.
    """
    letter = 'X'
    # Try to get content from PDBE.
    url_string = 'http://www.ebi.ac.uk/pdbe-srv/pdbechem/chemicalCompound/show/{0}'.format(code)
    r = requests.get(url_string)
    # Raise error if content not obtained.
    if not r.ok:
        raise IOError("Could not get to url {0}".format(url_string))

    # Parse r.text in an ugly way to get the required information.
    description = r.text.split('<h3>Molecule name')[1].split('</tr>')[0]
    description = description.strip().split('\n')[3].strip()[:255]
    modified = r.text.split("<h3>Standard parent ")[1].split('</tr>')[0]
    modified = modified.replace(" ", "").replace('\n', '').split('<')[-3].split('>')[-1]
    if modified == "NotAssigned":
        modified = None
    # Add the required information to a dictionary which can then be passed to add_amino_acid_to_json.
    aa_dict = {'code': code, 'description': description, 'modified': modified, 'letter': letter}
    return aa_dict