Deletes the binary with the given urn from the datastore.

  Args:
    binary_urn: RDFURN that serves as a unique identifier for the binary.
    token: ACL token to use with the legacy (non-relational) datastore.

  Raises:
    SignedBinaryNotFoundError: If the signed binary does not exist.

def DeleteSignedBinary(binary_urn,
                       token = None):
  """Deletes the binary with the given urn from the datastore.

  Args:
    binary_urn: RDFURN that serves as a unique identifier for the binary.
    token: ACL token to use with the legacy (non-relational) datastore.

  Raises:
    SignedBinaryNotFoundError: If the signed binary does not exist.
  """
  if _ShouldUseLegacyDatastore():
    try:
      aff4.FACTORY.Open(
          binary_urn, aff4_type=aff4.AFF4Stream, mode="r", token=token)
    except aff4.InstantiationError:
      raise SignedBinaryNotFoundError(binary_urn)
    aff4.FACTORY.Delete(binary_urn, token=token)

  if data_store.RelationalDBEnabled():
    try:
      data_store.REL_DB.ReadSignedBinaryReferences(
          _SignedBinaryIDFromURN(binary_urn))
    except db.UnknownSignedBinaryError:
      if _ShouldUseLegacyDatastore():
        # Migration of data isn't complete yet (we haven't started reading
        # exclusively from the relational DB), so this is probably ok.
        return
      else:
        raise SignedBinaryNotFoundError(binary_urn)
    data_store.REL_DB.DeleteSignedBinaryReferences(
        _SignedBinaryIDFromURN(binary_urn))