<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getauthority(self, default=None, encoding='utf-8', errors='strict'):
 """Return the decoded userinfo, host and port subcomponents of the URI authority as a three-item tuple. """

        # TBD: (userinfo, host, port) kwargs, default string?
        if default is None:
            default = (None, None, None)
        elif not isinstance(default, collections.Iterable):
            raise TypeError('Invalid default type')
        elif len(default) != 3:
            raise ValueError('Invalid default length')
        # TODO: this could be much more efficient by using a dedicated regex
        return (
            self.getuserinfo(default[0], encoding, errors),
            self.gethost(default[1], errors),
            self.getport(default[2])
        )