def _convert(expected_type, value):
 if (not isinstance(value, expected_type)):
  try:
   value = expected_type(value)
  except:
   raise TypeError(('expected ' + str(expected_type)))
 return value

def _convert ( expected_type , value ) : if ( not isinstance ( value , expected_type ) ) : try : value = expected_type ( value ) except : raise TypeError ( ( 'expected ' + str ( expected_type ) ) ) return value
convert value to given numeric type t .