<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_pk_value(self, instance):
 """ Get the primary key field value for a model instance. :param instance: The model instance to get the primary key for. :type instance: Model :return: The primary key value of the given model instance. """

        pk_field = instance._meta.pk.name
        pk = getattr(instance, pk_field, None)

        # Check to make sure that we got an pk not a model object.
        if isinstance(pk, models.Model):
            pk = self._get_pk_value(pk)
        return pk