<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_attribute(self, reference):
 """ Return the attribute that matches the reference. Raise an error if the attribute cannot be found, or if there is more then one match. """

        prefix, _, name = reference.rpartition('.')

        match = None
        for attribute in self._contents:
            if name == attribute.name and \
                    (not prefix or prefix == attribute.prefix):
                if match:
                    raise AttributeReferenceError(
                        'Ambiguous attribute reference: {}.'.format(
                            attribute.name))
                else:
                    match = attribute

        if match:
            return match
        raise AttributeReferenceError(
            'Attribute does not exist: {}'.format(reference))