code: def delete_identity(db, identity_id):
      
      with db.connect() as session:
          identity = find_identity(session, identity_id)
  
          if not identity:
              raise NotFoundError(entity=identity_id)
  
          delete_identity_db(session, identity)
docs: Remove an identity from the registry.
  
      This function removes from the registry, the identity which its identifier
      matches with id. Take into account that this function does not remove
      unique identities.
  
      When the given identity is not found in the registry a 'NotFoundError'
      exception is raised.
  
      :param db: database manager
      :param identity_id: identifier assigned to the identity that will
          be removed
  
      :raises NotFoundError: raised when the identity does not exist in the
          registry.