def main(self, argv):
        # Parse args once to find version
        parser = self.get_base_parser()
        (options, args) = parser.parse_known_args(argv)
        self._setup_logging(options.debug)
        self._setup_verbose(options.verbose)

        # build available subcommands based on version
        api_version = options.monasca_api_version
        subcommand_parser = self.get_subcommand_parser(api_version)
        self.parser = subcommand_parser

        # Handle top-level --help/-h before attempting to parse
        # a command off the command line
        if not args and options.help or not argv:
            self.do_help(options)
            return 0

        # Parse args again and call whatever callback was selected
        args = subcommand_parser.parse_args(argv)

        # Short-circuit and deal with help command right away.
        if args.func == self.do_help:
            self.do_help(args)
            return 0
        elif args.func == self.do_bash_completion:
            self.do_bash_completion(args)
            return 0

        if not args.os_username and not args.os_auth_token:
            raise exc.CommandError("You must provide a username via"
                                   " either --os-username or env[OS_USERNAME]"
                                   " or a token via --os-auth-token or"
                                   " env[OS_AUTH_TOKEN]")

        if not args.os_password and not args.os_auth_token:
            raise exc.CommandError("You must provide a password via"
                                   " either --os-password or env[OS_PASSWORD]"
                                   " or a token via --os-auth-token or"
                                   " env[OS_AUTH_TOKEN]")

        if args.os_no_client_auth:
            if not args.monasca_api_url:
                raise exc.CommandError("If you specify --os-no-client-auth"
                                       " you must specify a Monasca API URL"
                                       " via either --monasca-api-url or"
                                       " env[MONASCA_API_URL]")
        else:
            if not args.os_auth_url:
                raise exc.CommandError("You must provide an auth url via"
                                       " either --os-auth-url or via"
                                       " env[OS_AUTH_URL]")

        if args.os_auth_url and args.os_auth_url in 'v2.0':
            args.os_auth_url = string.replace(args.os_auth_url, 'v2.0', 'v3')

        kwargs = {
            'username': args.os_username,
            'password': args.os_password,
            'token': args.os_auth_token,
            'auth_url': args.os_auth_url,
            'service_type': args.os_service_type,
            'endpoint_type': args.os_endpoint_type,
            'os_cacert': args.os_cacert,
            'user_domain_id': args.os_user_domain_id,
            'user_domain_name': args.os_user_domain_name,
            'project_id': args.os_project_id,
            'project_name': args.os_project_name,
            'domain_id': args.os_domain_id,
            'domain_name': args.os_domain_name,
            'insecure': args.insecure,
            'region_name': args.os_region_name,
            'keystone_timeout': args.keystone_timeout
        }

        endpoint = args.monasca_api_url

        if not args.os_no_client_auth:
            _ksclient = ksclient.KSClient(**kwargs)
            if args.os_auth_token:
                token = args.os_auth_token
            else:
                try:
                    token = _ksclient.token
                except exc.CommandError:
                    raise exc.CommandError(
                        "User does not have a default project. "
                        "You must provide a project id using "
                        "--os-project-id or via env[OS_PROJECT_ID], "
                        "or you must provide a project name using "
                        "--os-project-name or via env[OS_PROJECT_NAME] "
                        "and a project domain using --os-domain-name, via "
                        "env[OS_DOMAIN_NAME],  using --os-domain-id or "
                        "via env[OS_DOMAIN_ID]")

            kwargs = {
                'token': token,
                'insecure': args.insecure,
                'os_cacert': args.os_cacert,
                'cert_file': args.cert_file,
                'key_file': args.key_file,
                'username': args.os_username,
                'password': args.os_password,
                'service_type': args.os_service_type,
                'endpoint_type': args.os_endpoint_type,
                'auth_url': args.os_auth_url,
                'keystone_timeout': args.keystone_timeout
            }

            if args.os_user_domain_name:
                kwargs['user_domain_name'] = args.os_user_domain_name
            if args.os_user_domain_id:
                kwargs['user_domain_id'] = args.os_user_domain_id
            if args.os_region_name:
                kwargs['region_name'] = args.os_region_name
            if args.os_project_name:
                kwargs['project_name'] = args.os_project_name
            if args.os_project_id:
                kwargs['project_id'] = args.os_project_id
            if args.os_domain_name:
                kwargs['domain_name'] = args.os_domain_name
            if args.os_domain_id:
                kwargs['domain_id'] = args.os_domain_id

            if not endpoint:
                endpoint = _ksclient.monasca_url

        client = monasca_client.Client(api_version, endpoint, **kwargs)

        args.func(client, args)
dataset/ETHPy150Open openstack/python-monascaclient/monascaclient/shell.py/MonascaShell.main/swapped operands of `in`