docs: def duplicate(self, contributor=None):
          """Duplicate (make a copy)."""
          if self.status not in [self.STATUS_DONE, self.STATUS_ERROR]:
              raise ValidationError('Data object must have done or error status to be duplicated')
  
          duplicate = Data.objects.get(id=self.id)
          duplicate.pk = None
          duplicate.slug = None
          duplicate.name = 'Copy of {}'.format(self.name)
          duplicate.duplicated = now()
          if contributor:
              duplicate.contributor = contributor
  
          duplicate._perform_save(force_insert=True)  # pylint: disable=protected-access
  
          assign_contributor_permissions(duplicate)
  
          # Override fields that are automatically set on create.
          duplicate.created = self.created
          duplicate._perform_save()  # pylint: disable=protected-access
  
          if self.location:
              self.location.data.add(duplicate)  # pylint: disable=no-member
  
          duplicate.storages.set(self.storages.all())  # pylint: disable=no-member
  
          for migration in self.migration_history.order_by('created'):  # pylint: disable=no-member
              migration.pk = None
              migration.data = duplicate
              migration.save(force_insert=True)
  
          # Inherit existing child dependencies.
          DataDependency.objects.bulk_create([
              DataDependency(child=duplicate, parent=dependency.parent, kind=dependency.kind)
              for dependency in DataDependency.objects.filter(child=self)
          ])
          # Inherit existing parent dependencies.
          DataDependency.objects.bulk_create([
              DataDependency(child=dependency.child, parent=duplicate, kind=dependency.kind)
              for dependency in DataDependency.objects.filter(parent=self)
          ])
  
          return duplicate