def as_serializable(self, attribute_filter=None, minified=False):
from prestans.parser import AttributeFilter<EOL>from prestans.parser import AttributeFilterImmutable<EOL>from prestans.types import Array<EOL>model_dictionary = dict()<EOL>rewrite_map = self.attribute_rewrite_map()<EOL>if isinstance(attribute_filter, AttributeFilter):<EOL><INDENT>attribute_filter = attribute_filter.as_immutable()<EOL><DEDENT>for attribute_name, type_instance in self.getmembers():<EOL><INDENT>if isinstance(attribute_filter, (AttributeFilter, AttributeFilterImmutable)) andnot attribute_filter.is_attribute_visible(attribute_name):<EOL><INDENT>continue<EOL><DEDENT>serialized_attribute_name = attribute_name<EOL>if minified is True:<EOL><INDENT>serialized_attribute_name = rewrite_map[attribute_name]<EOL><DEDENT>if attribute_name not in self._attributes or self._attributes[attribute_name] is None:<EOL><INDENT>if isinstance(type_instance, Array):<EOL><INDENT>model_dictionary[serialized_attribute_name] = []<EOL><DEDENT>else:<EOL><INDENT>model_dictionary[serialized_attribute_name] = None<EOL><DEDENT>continue<EOL><DEDENT>if isinstance(type_instance, DataCollection):<EOL><INDENT>sub_attribute_filter = None<EOL>if isinstance(attribute_filter, (AttributeFilter, AttributeFilterImmutable)) and attribute_name in attribute_filter:<EOL><INDENT>sub_attribute_filter = getattr(attribute_filter, attribute_name)<EOL><DEDENT>model_dictionary[serialized_attribute_name] = self._attributes[attribute_name].as_serializable(sub_attribute_filter, minified)<EOL><DEDENT>elif isinstance(type_instance, DataStructure):<EOL><INDENT>python_value = self._attributes[attribute_name]<EOL>serializable_value = type_instance.as_serializable(python_value)<EOL>model_dictionary[serialized_attribute_name] = serializable_value<EOL><DEDENT>elif isinstance(type_instance, DataType):<EOL><INDENT>model_dictionary[serialized_attribute_name] = self._attributes[attribute_name]<EOL><DEDENT><DEDENT>return model_dictionary<EOL>
Returns a dictionary with attributes and pure python representation of
the data instances. If an attribute filter is provided as_serializable
will respect the visibility.

The response is used by serializers to return data to client

:param attribute_filter:
:type attribute_filter: prestans.parser.AttributeFilter
:param minified:
:type minified: bool