code: def search(query, stats):
          
          log.debug("Search query: {0}".format(query))
          issues = []
          # Fetch data from the server in batches of MAX_RESULTS issues
          for batch in range(MAX_BATCHES):
              response = stats.parent.session.get(
                  "{0}/rest/api/latest/search?{1}".format(
                      stats.parent.url, urllib.urlencode({
                          "jql": query,
                          "fields": "summary,comment",
                          "maxResults": MAX_RESULTS,
                          "startAt": batch * MAX_RESULTS})))
              data = response.json()
              log.debug("Batch {0} result: {1} fetched".format(
                  batch, listed(data["issues"], "issue")))
              log.data(pretty(data))
              issues.extend(data["issues"])
              # If all issues fetched, we're done
              if len(issues) >= data["total"]:
                  break
          # Return the list of issue objects
          return [Issue(issue, prefix=stats.parent.prefix) for issue in issues]
docs: Perform issue search for given stats instance