<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def main():
 """ The "main" entry that controls the flow of the script based on the provided arguments. """

  setup_logging(logging.INFO)

  # Parse arguments
  parser = argparse.ArgumentParser(
    description="A utility to interact with AWS using Cloudera Manager.")
  parser.add_argument('-H', '--hostname', action='store', dest='hostname',
                      required=True,
                      help='The hostname of the Cloudera Manager server.')
  parser.add_argument('-p', action='store', dest='port', type=int,
                      help='The port of the Cloudera Manager server. Defaults '
                           'to 7180 (http) or 7183 (https).')
  parser.add_argument('-u', '--username', action='store', dest='username',
                      help='Login name.')
  parser.add_argument('--password', action='store', dest='password',
                      help='Login password.')
  parser.add_argument('--api-version', action='store', dest='api_version',
                      type=int,
                      default=MINIMUM_SUPPORTED_API_VERSION,
                      help='API version to be used. Defaults to {0}.'.format(
                        MINIMUM_SUPPORTED_API_VERSION))
  parser.add_argument('--tls', action='store_const', dest='use_tls',
                      const=True, default=False,
                      help='Whether to use tls (https).')
  parser.add_argument('-c', '--show-categories', action='store_true',
                      default=False, dest='show_categories',
                      help='Prints a list of supported external account '
                           'category names. For example, "AWS" is a supported '
                           'external account category name.')
  parser.add_argument('-t', '--show-types', action='store',
                      dest='category_name',
                      help='Prints a list of supported external account type '
                           'names for the given CATEGORY_NAME. For example, '
                           '"AWS_ACCESS_KEY_AUTH" is a supported external '
                           'account type name for external account category '
                           '"AWS".')
  parser.add_argument('-n', '--show-credentials', action='store',
                      dest='type_name',
                      help='Prints a list of available credential names for '
                           'the given TYPE_NAME.')
  parser.add_argument('--prune', action='store', dest='credential_name',
                      help='Runs S3Guard prune command on external account '
                           'associated with the given CREDENTIAL_NAME.')
  parser.add_argument('--version', action='version', version='%(prog)s 1.0')
  args = parser.parse_args()

  # Use the default port if required.
  if not args.port:
    if args.use_tls:
      args.port = DEFAULT_HTTPS_PORT
    else:
      args.port = DEFAULT_HTTP_PORT

  validate_api_compatibility(args)
  get_login_credentials(args)
  initialize_api(args)

  # Perform the AWS operation based on the input arguments.
  if args.show_categories:
    list_supported_categories()
  elif args.category_name:
    list_supported_types(args.category_name)
  elif args.type_name:
    list_credentials_by_name(args.type_name)
  elif args.credential_name:
    call_s3guard_prune(args.credential_name)
  else:
    print ("ERROR: No arguments given to perform any AWS operation.")
    parser.print_help()
    sys.exit(1)