code: def authorize(self, username, arguments=[],
                    authen_type=TAC_PLUS_AUTHEN_TYPE_ASCII, priv_lvl=TAC_PLUS_PRIV_LVL_MIN,
                    rem_addr=TAC_PLUS_VIRTUAL_REM_ADDR, port=TAC_PLUS_VIRTUAL_PORT):
          
          with self.closing():
              packet = self.send(
                  TACACSAuthorizationStart(username,
                                           TAC_PLUS_AUTHEN_METH_TACACSPLUS,
                                           priv_lvl, authen_type, arguments,
                                           rem_addr=rem_addr, port=port),
                  TAC_PLUS_AUTHOR
              )
              reply = TACACSAuthorizationReply.unpacked(packet.body)
              logger.debug('\n'.join([
                  reply.__class__.__name__,
                  'recv header <%s>' % packet.header,
                  'recv body <%s>' % reply
              ]))
              reply_arguments = dict([
                  arg.split(six.b('='), 1)
                  for arg in reply.arguments or []
                  if arg.find(six.b('=')) > -1]
              )
              user_priv_lvl = int(reply_arguments.get(
                  six.b('priv-lvl'), TAC_PLUS_PRIV_LVL_MAX))
              if user_priv_lvl < priv_lvl:
                  reply.status = TAC_PLUS_AUTHOR_STATUS_FAIL
          return reply
docs: Authorize with a TACACS+ server.
  
          :param username:
          :param arguments:      The authorization arguments
          :param authen_type:    TAC_PLUS_AUTHEN_TYPE_ASCII,
                                 TAC_PLUS_AUTHEN_TYPE_PAP,
                                 TAC_PLUS_AUTHEN_TYPE_CHAP
          :param priv_lvl:       Minimal Required priv_lvl.
          :param rem_addr:       AAA request source, default to TAC_PLUS_VIRTUAL_REM_ADDR
          :param port:           AAA port, default to TAC_PLUS_VIRTUAL_PORT
          :return:               TACACSAuthenticationReply
          :raises:               socket.timeout, socket.error