<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def perform(self):
 """ Perform actual request. """

        try:
            host = '{}://{}'.format(self._url.scheme, self._url.netloc)
            path = self._url.geturl().replace(host, '', 1)

            chunk = self.file.read(self._content_length)
            if self._upload_checksum:
                self._request_headers["upload-checksum"] = \
                    " ".join((
                        self._checksum_algorithm_name,
                        base64.b64encode(
                            self._checksum_algorithm(chunk).digest()
                        ).decode("ascii"),
                    ))
            self.handle.request("PATCH", path, chunk, self._request_headers)
            self._response = self.handle.getresponse()
            self.status_code = self._response.status
            self.response_headers = {k.lower(): v for k, v in self._response.getheaders()}
        except http.client.HTTPException as e:
            raise TusUploadFailed(e)
        # wrap connection related errors not raised by the http.client.HTTP(S)Connection
        # as TusUploadFailed exceptions to enable retries
        except OSError as e:
            if e.errno in (errno.EPIPE, errno.ESHUTDOWN, errno.ECONNABORTED, errno.ECONNREFUSED, errno.ECONNRESET):
                raise TusUploadFailed(e)
            raise e