import requests


def get_uniprot(accession, 
                uniprot_url='https://www.uniprot.org/uniprot/{0}.txt'):
    """
    Retrieve Uniprot Annotation file from Uniprot ID e.g. Q15858
    """
    try:
        results = requests.get(
            uniprot_url.format(accession.strip()), allow_redirects=True
        )
    except ValueError:
        raise ValueError('no Uniprot results retrieved for {0}'.format(accession))
    if results:
        return results.content.decode("utf-8")
    else:
        raise ValueError('no Uniprot results retrieved for {0}'.format(accession))