def _get_indices(input_items, wanted_items):
 try:
  iter(input_items)
 except:
  raise ValueError('The input_items to search must be iterable.')
 try:
  len(wanted_items)
 except:
  wanted_items = [wanted_items]
 if isinstance(wanted_items, basestring):
  wanted_items = [wanted_items]
 return [input_items.index(item) for item in wanted_items if (item in input_items)]

def _get_indices ( input_items , wanted_items ) : try : iter ( input_items ) except : raise ValueError ( 'The input_items to search must be iterable.' ) try : len ( wanted_items ) except : wanted_items = [ wanted_items ] if isinstance ( wanted_items , basestring ) : wanted_items = [ wanted_items ] return [ input_items . index ( item ) for item in wanted_items if ( item in input_items ) ]
returns indices of the wanted items in the input items if present .