code: def authenticated(function):
      
      def wrapped(*args):
          """Wrap function."""
          try:
              return function(*args)
          except UPSError:
              _login(*args)
              return function(*args)
      return wrapped
docs: Re-authenticate if session expired.