<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _prepare_value(self, value, dj_field=None):
 """Cook the value"""

        from django.db import models

        if isinstance(value, (six.string_types, int, float)):
            return value
        elif isinstance(value, SimpleLazyObject):
            return value.pk
        elif isinstance(value, models.Model):
            if dj_field:
                if isinstance(dj_field, models.ForeignKey):
                    return value.pk
                    #TODO validate other types
            return value
        elif isinstance(value, (ResultSet, EmptyQuerySet, EmptyResultSet, list)):
            return [self._prepare_value(v, dj_field=dj_field) for v in value]
        elif isinstance(value, QuerySet):
            value = value._clone()
            return [self._prepare_value(v, dj_field=dj_field) for v in value]
        return value