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

        url = self.url + "/" + query
        log.debug("GitHub query: {0}".format(url))
        try:
            request = urllib2.Request(url, headers=self.headers)
            response = urllib2.urlopen(request)
            log.debug("Response headers:\n{0}".format(
                unicode(response.info()).strip()))
        except urllib2.URLError as error:
            log.debug(error)
            raise ReportError(
                "GitHub search on {0} failed.".format(self.url))
        result = json.loads(response.read())["items"]
        log.debug("Result: {0} fetched".format(listed(len(result), "item")))
        log.data(pretty(result))
        return result