def format_field(self, field):
if field is None:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>elif isinstance(field, TypeError):<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>elif isinstance(field, Decimal):<EOL><INDENT>if field % <NUM_LIT:1> == <NUM_LIT:0>:<EOL><INDENT>return str(int(field))<EOL><DEDENT>return str(float(field))<EOL><DEDENT>elif isinstance(field, set):<EOL><INDENT>return "<STR_LIT:(>" + "<STR_LIT:U+002CU+0020>".join([self.format_field(v) for v in field]) + "<STR_LIT:)>"<EOL><DEDENT>elif isinstance(field, datetime):<EOL><INDENT>return field.isoformat()<EOL><DEDENT>elif isinstance(field, timedelta):<EOL><INDENT>rd = relativedelta(<EOL>seconds=int(field.total_seconds()), microseconds=field.microseconds<EOL>)<EOL>return delta_to_str(rd)<EOL><DEDENT>elif isinstance(field, Binary):<EOL><INDENT>return "<STR_LIT>" % len(field.value)<EOL><DEDENT>pretty = repr(field)<EOL>if pretty.startswith("<STR_LIT>"):<EOL><INDENT>return pretty[<NUM_LIT:1>:]<EOL><DEDENT>return pretty<EOL>
Format a single Dynamo value