code: def ingest(self, text, logMessage=None):
          
          # NOTE: ingest method supports additional options for
          # label/format/namespace/ownerId, etc - but we generally set
          # those in the foxml that is passed in
  
          http_args = {}
          if logMessage:
              http_args['logMessage'] = logMessage
  
          headers = {'Content-Type': 'text/xml'}
  
          url = 'objects/new'
  
          # if text is unicode, it needs to be encoded so we can send the
          # data as bytes; otherwise, we get ascii encode errors in httplib/ssl
          if isinstance(text, six.text_type):
              text = bytes(text.encode('utf-8'))
  
          return self.post(url, data=text, params=http_args, headers=headers)
docs: Ingest a new object into Fedora. Returns the pid of the new object on success.
          Return response should have a status of 201 Created on success, and
          the content of the response will be the newly created pid.
  
          Wrapper function for `Fedora REST API ingest <http://fedora-commons.org/confluence/display/FCR30/REST+API#RESTAPI-ingest>`_
  
          :param text: full text content of the object to be ingested
          :param logMessage: optional log message
          :rtype: :class:`requests.models.Response`