def _convert(value, to_type, default=None):
try:<EOL><INDENT>return default if value is None else to_type(value)<EOL><DEDENT>except ValueError:<EOL><INDENT>return default<EOL><DEDENT>
Convert value to to_type, returns default if fails.