code: def _save_artifact(build, data, content_type):
      
      sha1sum = hashlib.sha1(data).hexdigest()
      artifact = models.Artifact.query.filter_by(id=sha1sum).first()
  
      if artifact:
        logging.debug('Upload already exists: artifact_id=%r', sha1sum)
      else:
        logging.info('Upload received: artifact_id=%r, content_type=%r',
                     sha1sum, content_type)
        artifact = models.Artifact(
            id=sha1sum,
            content_type=content_type,
            data=data)
        _artifact_created(artifact)
  
      artifact.owners.append(build)
      return artifact
docs: Saves an artifact to the DB and returns it.