'Initializes the current instance from an Aff4Object.
Iterates over all attributes of the Aff4Object defined by a given class
and adds a representation of them to the current instance.
Args:
aff4_obj: An Aff4Object to take the attributes from.
aff4_cls: A class in the inheritance hierarchy of the Aff4Object
defining which attributes to take.
attr_blacklist: A list of already added attributes as to not add
attributes multiple times.
Returns:
A reference to the current instance.'

def InitFromAff4Object(self, aff4_obj, aff4_cls, attr_blacklist):

    self.name = str(aff4_cls.__name__)
    self.attributes = []
    schema = aff4_cls.SchemaCls
    for (name, attribute) in sorted(schema.__dict__.items()):
        if (not isinstance(attribute, aff4.Attribute)):
            continue
        if (name in attr_blacklist):
            continue
        attr_repr = ApiAff4ObjectAttribute()
        attr_repr.name = name
        attr_repr.description = attribute.description
        attr_repr.values = []
        values = list(aff4_obj.GetValuesForAttribute(attribute))
        for value in values:
            if hasattr(value, 'ToRDFValue'):
                value = value.ToRDFValue()
            value_repr = ApiAff4ObjectAttributeValue()
            value_repr.type = value.__class__.__name__
            value_repr.age = value.age
            value_repr.value = value
            attr_repr.values.append(value_repr)
        if attr_repr.values:
            self.attributes.append(attr_repr)
    return self
