Handle authentication checks.

    .. py:decorator:: requires_auth

        Checks if the token has expired and performs authentication if needed.

def requires_auth(func):
    """Handle authentication checks.

    .. py:decorator:: requires_auth

        Checks if the token has expired and performs authentication if needed.
    """
    @six.wraps(func)
    def wrapper(self, *args, **kwargs):
        if self.token_expired:
            self.authenticate()
        return func(self, *args, **kwargs)
    return wrapper