def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_2_0):
if kmip_version < enums.KMIPVersion.KMIP_2_0:<EOL><INDENT>raise exceptions.VersionNotSupported(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>kmip_version.value<EOL>)<EOL>)<EOL><DEDENT>local_buffer = BytearrayStream()<EOL>if self._vendor_identification:<EOL><INDENT>self._vendor_identification.write(<EOL>local_buffer,<EOL>kmip_version=kmip_version<EOL>)<EOL><DEDENT>else:<EOL><INDENT>raise exceptions.InvalidField(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if self._attribute_name:<EOL><INDENT>self._attribute_name.write(<EOL>local_buffer,<EOL>kmip_version=kmip_version<EOL>)<EOL><DEDENT>else:<EOL><INDENT>raise exceptions.InvalidField(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>self.length = local_buffer.length()<EOL>super(AttributeReference, self).write(<EOL>output_buffer,<EOL>kmip_version=kmip_version<EOL>)<EOL>output_buffer.write(local_buffer.buffer)<EOL>
Write the AttributeReference structure encoding to the data stream.

Args:
    output_buffer (stream): A data stream in which to encode
        Attributes structure data, supporting a write method.
    kmip_version (enum): A KMIPVersion enumeration defining the KMIP
        version with which the object will be encoded. Optional,
        defaults to KMIP 2.0.

Raises:
    InvalidField: Raised if the vendor identification or attribute name
        fields are not defined.
    VersionNotSupported: Raised when a KMIP version is provided that
        does not support the AttributeReference structure.