<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def sendrequest(self, request):
        '''
            Recieves a request xml as a string and posts it
            to the health service url specified in the
            settings.py
        '''
        url = urlparse.urlparse(self.connection.healthserviceurl)
        conn = None
        if url.scheme == 'https':
            conn = httplib.HTTPSConnection(url.netloc)
        else:
            conn = httplib.HTTPConnection(url.netloc)
        conn.putrequest('POST', url.path)
        conn.putheader('Content-Type', 'text/xml')
        conn.putheader('Content-Length', '%d' % len(request))
        conn.endheaders()
        try:
            conn.send(request)
        except socket.error, v:
            if v[0] == 32:      # Broken pipe
                conn.close()
            raise
        response = conn.getresponse().read()
        return etree.fromstring(response)