code: def _is_import_binding(node, name, package=None):
      
  
      if node.type == syms.import_name and not package:
          imp = node.children[1]
          if imp.type == syms.dotted_as_names:
              for child in imp.children:
                  if child.type == syms.dotted_as_name:
                      if child.children[2].value == name:
                          return node
                  elif child.type == token.NAME and child.value == name:
                      return node
          elif imp.type == syms.dotted_as_name:
              last = imp.children[-1]
              if last.type == token.NAME and last.value == name:
                  return node
          elif imp.type == token.NAME and imp.value == name:
              return node
      elif node.type == syms.import_from:
          # unicode(...) is used to make life easier here, because
          # from a.b import parses to ['import', ['a', '.', 'b'], ...]
          if package and unicode(node.children[1]).strip() != package:
              return None
          n = node.children[3]
          if package and _find(u"as", n):
              # See test_from_import_as for explanation
              return None
          elif n.type == syms.import_as_names and _find(name, n):
              return node
          elif n.type == syms.import_as_name:
              child = n.children[2]
              if child.type == token.NAME and child.value == name:
                  return node
          elif n.type == token.NAME and n.value == name:
              return node
          elif package and n.type == token.STAR:
              return node
      return None
docs: Will reuturn node if node will import name, or node
          will import * from package.  None is returned otherwise.
          See test cases for examples.