def search_code(self, query, sort=None, order=None, per_page=None,
                    text_match=False, number=-1, etag=None):
        params = {'q': query}
        headers = {}
        if sort == 'indexed':
            params['sort'] = sort
        if sort and order in ('asc', 'desc'):
            params['order'] = order
        if text_match:
            headers = {
                'Accept': 'application/vnd.github.v3.full.text-match+json'
                }
        url = self._build_url('search', 'code')
        return SearchIterator(number, url, CodeSearchResult, self, params,
                              etag, headers)