def filter_re_search(val, pattern):
 if (not isinstance(val, basestring)):
  return val
 result = re.search(pattern, val)
 if result:
  return result.group(0)
 return u''

def filter_re_search ( val , pattern ) : if ( not isinstance ( val , basestring ) ) : return val result = re . search ( pattern , val ) if result : return result . group ( 0 ) return u''
perform a search for given regexp pattern .