code: def accept_best_match(accept_header, mimetypes):
      
      for mimetype_pattern, _ in _parse_and_sort_accept_header(accept_header):
          matched_types = fnmatch.filter(mimetypes, mimetype_pattern)
          if matched_types:
              return matched_types[0]
      return mimetypes[0]
docs: Return a mimetype best matched the accept headers.
  
      >>> accept_best_match('application/json, text/html', ['application/json', 'text/plain'])
      'application/json'
  
      >>> accept_best_match('application/json;q=0.5, text/*', ['application/json', 'text/plain'])
      'text/plain'