def _get_attributes_from_managed_object(self, managed_object, attr_names):
attr_factory = attribute_factory.AttributeFactory()<EOL>retrieved_attributes = list()<EOL>if not attr_names:<EOL><INDENT>attr_names = self._attribute_policy.get_all_attribute_names()<EOL><DEDENT>for attribute_name in attr_names:<EOL><INDENT>object_type = managed_object._object_type<EOL>if not self._attribute_policy.is_attribute_supported(<EOL>attribute_name<EOL>):<EOL><INDENT>continue<EOL><DEDENT>if self._attribute_policy.is_attribute_applicable_to_object_type(<EOL>attribute_name,<EOL>object_type<EOL>):<EOL><INDENT>try:<EOL><INDENT>attribute_value = self._get_attribute_from_managed_object(<EOL>managed_object,<EOL>attribute_name<EOL>)<EOL><DEDENT>except Exception:<EOL><INDENT>attribute_value = None<EOL><DEDENT>if attribute_value is not None:<EOL><INDENT>if self._attribute_policy.is_attribute_multivalued(<EOL>attribute_name<EOL>):<EOL><INDENT>for count, value in enumerate(attribute_value):<EOL><INDENT>attribute = attr_factory.create_attribute(<EOL>enums.AttributeType(attribute_name),<EOL>value,<EOL>count<EOL>)<EOL>retrieved_attributes.append(attribute)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>attribute = attr_factory.create_attribute(<EOL>enums.AttributeType(attribute_name),<EOL>attribute_value<EOL>)<EOL>retrieved_attributes.append(attribute)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return retrieved_attributes<EOL>
Given a kmip.pie object and a list of attribute names, attempt to get
all of the existing attribute values from the object.