def filterListValue(value, regex):
 if (isinstance(value, list) and regex):
  retVal = filter((lambda _: re.search(regex, _, re.I)), value)
 else:
  retVal = value
 return retVal

def filterListValue ( value , regex ) : if ( isinstance ( value , list ) and regex ) : retVal = filter ( ( lambda _ : re . search ( regex , _ , re . I ) ) , value ) else : retVal = value return retVal
returns list with items that have parts satisfying given regular expression .