<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_representation(self, instance):
 """ Object instance -> Dict of primitive datatypes. """

        ret = OrderedDict()
        readable_fields = [
            field for field in self.fields.values()
            if not field.write_only
        ]

        for field in readable_fields:
            try:
                field_representation = self._get_field_representation(field, instance)
                ret[field.field_name] = field_representation
            except SkipField:
                continue

        return ret