Returns the size of the given binary (in bytes).

  Args:
    binary_urn: RDFURN that uniquely identifies the binary.
    token: ACL token to use with the legacy (non-relational) datastore.

  Raises:
    SignedBinaryNotFoundError: If no signed binary with the given URN exists.

def FetchSizeOfSignedBinary(binary_urn,
                            token = None
                           ):
  """Returns the size of the given binary (in bytes).

  Args:
    binary_urn: RDFURN that uniquely identifies the binary.
    token: ACL token to use with the legacy (non-relational) datastore.

  Raises:
    SignedBinaryNotFoundError: If no signed binary with the given URN exists.
  """
  if _ShouldUseLegacyDatastore():
    try:
      aff4_stream = aff4.FACTORY.Open(
          binary_urn, aff4_type=collects.GRRSignedBlob, mode="r", token=token)
      return aff4_stream.size
    except aff4.InstantiationError:
      raise SignedBinaryNotFoundError(binary_urn)
  else:
    try:
      references, _ = data_store.REL_DB.ReadSignedBinaryReferences(
          _SignedBinaryIDFromURN(binary_urn))
    except db.UnknownSignedBinaryError:
      raise SignedBinaryNotFoundError(binary_urn)
    last_reference = references.items[-1]
    return last_reference.offset + last_reference.size