def get_first_import(node, context, name, base, level):
 fullname = (('%s.%s' % (base, name)) if base else name)
 first = None
 found = False
 for first in context.body:
  if (first is node):
   continue
  if ((first.scope() is node.scope()) and (first.fromlineno > node.fromlineno)):
   continue
  if isinstance(first, astroid.Import):
   if any(((fullname == iname[0]) for iname in first.names)):
    found = True
    break
  elif isinstance(first, astroid.From):
   if ((level == first.level) and any(((fullname == ('%s.%s' % (first.modname, iname[0]))) for iname in first.names))):
    found = True
    break
 if (found and (not are_exclusive(first, node))):
  return first

def get_first_import ( node , context , name , base , level ) : fullname = ( ( '%s.%s' % ( base , name ) ) if base else name ) first = None found = False for first in context . body : if ( first is node ) : continue if ( ( first . scope ( ) is node . scope ( ) ) and ( first . fromlineno > node . fromlineno ) ) : continue if isinstance ( first , astroid . Import ) : if any ( ( ( fullname == iname [ 0 ] ) for iname in first . names ) ) : found = True break elif isinstance ( first , astroid . From ) : if ( ( level == first . level ) and any ( ( ( fullname == ( '%s.%s' % ( first . modname , iname [ 0 ] ) ) ) for iname in first . names ) ) ) : found = True break if ( found and ( not are_exclusive ( first , node ) ) ) : return first
return the node where [base .