code: def get_bibtex(doi):
      
      try:
          request = requests.get(to_url(doi),
                                 headers={"accept": "application/x-bibtex"})
          request.raise_for_status()
          assert request.headers.get("content-type") == "application/x-bibtex"
          return request.text
      except (RequestException, AssertionError):
          return None
docs: Get a BibTeX entry for a given DOI.
  
      .. note::
  
          Adapted from https://gist.github.com/jrsmith3/5513926.
  
      :param doi: The canonical DOI to get BibTeX from.
      :returns: A BibTeX string or ``None``.
  
      >>> get_bibtex('10.1209/0295-5075/111/40005')
      '@article{Verney_2015,\\n\\tdoi = {10.1209/0295-5075/111/40005},\\n\\turl = {http://dx.doi.org/10.1209/0295-5075/111/40005},\\n\\tyear = 2015,\\n\\tmonth = {aug},\\n\\tpublisher = {{IOP} Publishing},\\n\\tvolume = {111},\\n\\tnumber = {4},\\n\\tpages = {40005},\\n\\tauthor = {Lucas Verney and Lev Pitaevskii and Sandro Stringari},\\n\\ttitle = {Hybridization of first and second sound in a weakly interacting Bose gas},\\n\\tjournal = {{EPL}}\\n}'