def _index(key, sequence, testfn=None, keyfn=None):
 index = 0
 for element in sequence:
  value = element
  if keyfn:
   value = keyfn(value)
  if (((not testfn) and (value == key)) or (testfn and testfn(value, key))):
   return index
  index = (index + 1)
 return None

def _index ( key , sequence , testfn = None , keyfn = None ) : index = 0 for element in sequence : value = element if keyfn : value = keyfn ( value ) if ( ( ( not testfn ) and ( value == key ) ) or ( testfn and testfn ( value , key ) ) ) : return index index = ( index + 1 ) return None
return the index of key within sequence .