code: def get_parent_lookup_field(self):
          
          if hasattr(self.Meta, "parent_lookup_field"):
              return getattr(self.Meta, "parent_lookup_field")
          elif hasattr(self.Meta, "parent_model"):
              model = getattr(self.Meta, "parent_model")
          else:
              parent_models = filter(
                  lambda field: isinstance(field, db_models.ForeignKey),
                  self.Meta.model._meta.fields
              )
              assert len(parent_models) > 0, self.default_error_messages['no_parent']
              assert len(parent_models) == 1, self.default_error_messages['multiple_parents']
              model = parent_models[0].related_model
  
          return '%(model_name)s__pk' % {
              'app_label': model._meta.app_label,
              'model_name': model._meta.object_name.lower()
          }
docs: Return tha parent_lookup_field for the NestedHyperlinkedModelSerializer.
          If `parent_lookup_field` of `parent_model` is not defined lookup ForeignKey field of model.
          :return: parent_lookup_field