Dumps the given aff4object into a yaml representation.

def YamlDumper(aff4object):
  """Dumps the given aff4object into a yaml representation."""
  aff4object.Flush()

  result = {}
  for attribute, values in iteritems(aff4object.synced_attributes):
    result[attribute.predicate] = []
    for value in values:
      # This value is really a LazyDecoder() instance. We need to get at the
      # real data here.
      value = value.ToRDFValue()

      result[attribute.predicate].append(
          [value.__class__.__name__,
           value.SerializeToString(),
           str(value.age)])

  return yaml.Dump({
      "aff4_class": compatibility.GetName(aff4object),
      "_urn": aff4object.urn.SerializeToString(),
      "attributes": result,
      "age_policy": aff4object.age_policy,
  })