<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect(self, fedora_url, data=None, method='Get'):
 """Method attempts to connect to REST servers of the Fedora Commons repository using optional data parameter. Args: fedora_url(string):
 Fedora URL data(dict):
 Data to through to REST endpoint method(str):
 REST Method, defaults to GET Returns: result(string):
 Response string from Fedora """

        if data is None:
            data = {}
        if not fedora_url.startswith("http"):
            fedora_url = urllib.parse.urljoin(self.base_url, fedora_url)
        request = urllib.request.Request(fedora_url,
                                         method=method)
        request.add_header('Accept', 'text/turtle')
        request.add_header('Content-Type', 'text/turtle')
        if len(data) > 0:
            request.data = data
        try:
            response = urllib.request.urlopen(request)
        except urllib.error.URLError as err:
            if hasattr(err, 'reason'):
                print("failed to reach server at {} with {} method".format(
                    fedora_url,
                    request.method))
                print("Reason: ", err.reason)
                print("Data: ", data)
            elif hasattr(err, 'code'):
                print("Server error {}".format(err.code))
            raise err
        return response