def addUnitTypeConversion(unitLabel, mappingFunc):
 if (unitLabel in _unit2PixMappings):
  msg = 'The unit type label [{0}] is already registered with PsychoPy'
  raise ValueError(msg.format(unitLabel))
 _unit2PixMappings[unitLabel] = mappingFunc

def addUnitTypeConversion ( unitLabel , mappingFunc ) : if ( unitLabel in _unit2PixMappings ) : msg = 'The unit type label [{0}] is already registered with PsychoPy' raise ValueError ( msg . format ( unitLabel ) ) _unit2PixMappings [ unitLabel ] = mappingFunc
add support for converting units specified by unit_label to pixels to be used by converttopix mapping_func must have the function prototype: def mapping_func: # convert the input vertices .