def find_name(name, state, high):
 ext_id = []
 if (name in high):
  ext_id.append((name, state))
 elif (state == 'sls'):
  for (nid, item) in six.iteritems(high):
   if (item['__sls__'] == name):
    ext_id.append((nid, next(iter(item))))
 else:
  for nid in high:
   if (state in high[nid]):
    if isinstance(high[nid][state], list):
     for arg in high[nid][state]:
      if (not isinstance(arg, dict)):
       continue
      if (len(arg) != 1):
       continue
      if (arg[next(iter(arg))] == name):
       ext_id.append((nid, state))
 return ext_id

def find_name ( name , state , high ) : ext_id = [ ] if ( name in high ) : ext_id . append ( ( name , state ) ) elif ( state == 'sls' ) : for ( nid , item ) in six . iteritems ( high ) : if ( item [ '__sls__' ] == name ) : ext_id . append ( ( nid , next ( iter ( item ) ) ) ) else : for nid in high : if ( state in high [ nid ] ) : if isinstance ( high [ nid ] [ state ] , list ) : for arg in high [ nid ] [ state ] : if ( not isinstance ( arg , dict ) ) : continue if ( len ( arg ) != 1 ) : continue if ( arg [ next ( iter ( arg ) ) ] == name ) : ext_id . append ( ( nid , state ) ) return ext_id
scan high data for the id referencing the given name and return a list of tuples that match note: if state is sls .