def from_doi(doi):
    """
    Get the arXiv eprint id for a given DOI.

    .. note::

        Uses arXiv API. Will not return anything if arXiv is not aware of the
        associated DOI.

    :param doi: The DOI of the resource to look for.
    :returns: The arXiv eprint id, or ``None`` if not found.

    >>> from_doi('10.1209/0295-5075/111/40005')
    # Note: Test do not pass due to an arXiv API bug.
    '1506.06690'
    """
    try:
        request = requests.get("http://export.arxiv.org/api/query",
                               params={
                                   "search_query": "doi:%s" % (doi,),
                                   "max_results": 1
                               })
        request.raise_for_status()
    except RequestException:
        return None
    root = xml.etree.ElementTree.fromstring(request.content)
    for entry in root.iter("{http://www.w3.org/2005/Atom}entry"):
        arxiv_id = entry.find("{http://www.w3.org/2005/Atom}id").text
        # arxiv_id is an arXiv full URL. We only want the id which is the last
        # URL component.
        return arxiv_id.split("/")[-1]
    return None
Get the arXiv eprint id for a given DOI.

    .. note::

        Uses arXiv API. Will not return anything if arXiv is not aware of the
        associated DOI.

    :param doi: The DOI of the resource to look for.
    :returns: The arXiv eprint id, or ``None`` if not found.

    >>> from_doi('10.1209/0295-5075/111/40005')
    # Note: Test do not pass due to an arXiv API bug.
    '1506.06690'