code: def check_entitlement(doi):
      
      if doi.lower().startswith('doi:'):
          doi = doi[4:]
      url = '%s/%s' % (elsevier_entitlement_url, doi)
      params = {'httpAccept': 'text/xml'}
      res = requests.get(url, params, headers=ELSEVIER_KEYS)
      if not res.status_code == 200:
          logger.error('Could not check entitlements for article %s: '
                       'status code %d' % (doi, res.status_code))
          logger.error('Response content: %s' % res.text)
          return False
      return True
docs: Check whether IP and credentials enable access to content for a doi.
  
      This function uses the entitlement endpoint of the Elsevier API to check
      whether an article is available to a given institution. Note that this
      feature of the API is itself not available for all institution keys.