def _DoRemapping(element, map):
 if ((map is not None) and (element is not None)):
  if (not callable(map)):
   map = map.get
  if (isinstance(element, list) or isinstance(element, tuple)):
   element = filter(None, [map(elem) for elem in element])
  else:
   element = map(element)
 return element

def _DoRemapping ( element , map ) : if ( ( map is not None ) and ( element is not None ) ) : if ( not callable ( map ) ) : map = map . get if ( isinstance ( element , list ) or isinstance ( element , tuple ) ) : element = filter ( None , [ map ( elem ) for elem in element ] ) else : element = map ( element ) return element
if |element| then remap it through |map| .