<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def attribute_string(self):
 """Restore an entries attributes in original format, escaping reserved characters when necessary Returns: str: escaped attributes as tag=value pairs, separated by semi-colon """

        escape_map = {ord('='): '%3D',
                      ord(','): '%2C',
                      ord(';'): '%3B',
                      ord('&'): '%26',
                      ord('\t'): '%09',
                     }

        list_type = type(list())

        attrs = self.attributes
        if type(attrs) is OrderedDict:
            reserved_attrs = []
            other_attrs = []

            for name, value in attrs.items():
                # Escape reserved characters
                name = name.translate(escape_map)

                if type(value) == list_type:
                    value = ','.join([i.translate(escape_map) for i in value])
                else:
                    value = value.translate(escape_map)

                # Regain original formatting of attribute column
                out_attr = '{0}={1}'.format(name, value)

                # Order attributes so that reserved tags are output first
                if name[0].isupper():
                    reserved_attrs.append(out_attr)
                else:
                    other_attrs.append(out_attr)

            out_attrs = ';'.join(reserved_attrs + other_attrs)

        else:
            out_attrs = attrs

        return out_attrs