docs: def main(cls, args, settings=None, userdata=None):  # pylint: disable=too-many-branches,too-many-statements
          """Main entry point of this module.
          """
          # The command-line client uses Service Account authentication.
          logger.info('Using Compute Engine credentials from %s', Focus.info(args.conf.name))
          try:
              key = json.loads(args.conf.read())
          except ValueError as msg:
              logger.error('Unable to parse %s: %s', args.conf.name, msg)
              return 1
  
          # Compute Engine Manager
          try:
              cluster = ComputeEngineManager(key['client_email'], args.conf.name, key['project_id'])
              cluster.connect()
              # Remove read |key| from memory which contains the private key.
              del key
          except ComputeEngineManagerException as msg:
              logger.error(msg)
              return 1
  
          # Create one or many compute VMs.
          if args.create:
              if args.tags:
                  logger.info('Assigning the following tags to the instance: %r', args.tags)
  
              container_declaration = args.declaration.read()
              try:
                  disk = cluster.build_bootdisk(args.image, args.disk_size, args.disk_auto_delete)
                  conf = cluster.build_container_vm(container_declaration, disk,
                                                    zone=args.zone,
                                                    tags=args.tags,
                                                    preemptible=args.preemptible)
              except ComputeEngineManagerException as msg:
                  logging.error(msg)
                  return 1
  
              logging.debug('VM Configuration: %r', conf)
              try:
                  logging.info('Creating %d VM%s of type "%s" ...',
                               args.count, Common.pluralize(args.count), args.size)
                  nodes = cluster.create(args.size, args.count, conf, image=args.image)
                  for node in nodes:
                      logging.info('Node %s created and %s.', node.name, node.state)
              except ComputeEngineManagerException as msg:
                  logging.error(msg)
                  return 1
  
          # Run filters before dealing with any state routine.
          nodes = []
          if any([args.stop, args.start, args.reboot, args.terminate]):
              nodes = cls.list(cls, cluster, args.zone, args.states, args.names, args.tags)
  
          # Routines for other VM states.
          if args.start:
              try:
                  logger.info("Starting %d node%s ...", len(nodes), Common.pluralize(nodes))
                  cluster.start(nodes)
              except ComputeEngineManagerException as msg:
                  logger.error(msg)
                  return 1
  
          if args.stop:
              try:
                  logger.info("Stopping %d node%s ...", len(nodes), Common.pluralize(nodes))
                  cluster.stop(nodes)
              except ComputeEngineManagerException as msg:
                  logger.error(msg)
                  return 1
  
          if args.reboot:
              try:
                  logger.info("Rebooting %d node%s ...", len(nodes), Common.pluralize(nodes))
                  cluster.reboot(nodes)
              except ComputeEngineManagerException as msg:
                  logger.error(msg)
                  return 1
  
          if args.terminate:
              try:
                  logger.info("Terminating %d node%s ...", len(nodes), Common.pluralize(nodes))
                  cluster.terminate_ex(nodes, True)
              except ComputeEngineManagerException as msg:
                  logger.error(msg)
                  return 1
  
          if args.list:
              try:
                  nodes = cls.list(cls, cluster, args.zone, args.states, args.names, args.tags)
                  for node in nodes:
                      logging.info('Node: %s is %s; IP: %s (%s); Preemtible: %s',
                                   node.name, node.state,
                                   Kurz.ips(node), Kurz.zone(node), Kurz.is_preemtible(node))
              except ComputeEngineManagerException as msg:
                  logger.error(msg)
                  return 1
  
          return 0