<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ingest(self, text, logMessage=None):
 """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` """

        # 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)