code: def hacking_import_rules(logical_line, filename, noqa):
      r
      # TODO(jogo): make the following doctests pass:
      #            H301: import os, sys
      # TODO(mordred: We need to split this into different checks so that they
      # can be disabled by command line switches properly
  
      if noqa:
          return
  
      split_line = logical_line.split()
      split_line_len = len(split_line)
      if (split_line_len > 1 and split_line[0] in ('import', 'from') and
              not core.is_import_exception(split_line[1])):
          pos = logical_line.find(',')
          if pos != -1:
              if split_line[0] == 'from':
                  yield pos, "H301: one import per line"
          pos = logical_line.find('*')
          if pos != -1:
              yield pos, "H303: No wildcard (*) import."
              return
  
          if split_line_len in (2, 4, 6) and split_line[1] != "__future__":
              if 'from' == split_line[0] and split_line_len > 3:
                  mod = '.'.join((split_line[1], split_line[3]))
                  if core.is_import_exception(mod):
                      return
                  if RE_RELATIVE_IMPORT.search(logical_line):
                      yield logical_line.find('.'), (
                          "H304: No relative imports. '%s' is a relative import"
                          % logical_line)
                      return
docs: r"""Check for imports.
  
      OpenStack HACKING guide recommends one import per line:
      Do not import more than one module per line
  
      Examples:
      Okay: from nova.compute import api
      H301: from nova.compute import api, utils
  
  
      Do not use wildcard import
  
      Do not make relative imports
  
      Examples:
      Okay: from os import path
      Okay: from os import path as p
      Okay: from os import (path as p)
      Okay: import os.path
      Okay: from nova.compute import rpcapi
      Okay: from six.moves.urllib import parse
      H303: from os.path import *
      H304: from .compute import rpcapi