code: def download_schema(uri, path, comment=None):
      
      # if requests isn't available, warn and bail out
      if requests is None:
          sys.stderr.write(req_requests_msg)
          return
  
      # short-hand name of the schema, based on uri
      schema = os.path.basename(uri)
      try:
  
          req = requests.get(uri, stream=True)
          req.raise_for_status()
          with open(path, 'wb') as schema_download:
              for chunk in req.iter_content(chunk_size=1024):
                  if chunk: # filter out keep-alive new chunks
                      schema_download.write(chunk)
          # if a comment is specified, add it to the locally saved schema
          if comment is not None:
              tree = etree.parse(path)
              tree.getroot().append(etree.Comment(comment))
              with open(path, 'wb') as xml_catalog:
                  xml_catalog.write(etree.tostring(tree, pretty_print=True,
                      xml_declaration=True, encoding="UTF-8"))
              logger.debug('Downloaded schema %s', schema)
  
          return True
  
      except requests.exceptions.HTTPError as err:
          msg = 'Failed to download schema %s' % schema
          msg += '(error codes %s)' % err.response.status_code
          logger.warn(msg)
  
          return False
docs: Download a schema from a specified URI and save it locally.
  
      :param uri: url where the schema should be downloaded
      :param path: local file path where the schema should be saved
      :param comment: optional comment; if specified, will be added to
          the downloaded schema
      :returns: true on success, false if there was an error and the
          schema failed to download