docs: def get_log_level(args):
      # type: (typing.Dict[str, typing.Any]) -> int
      """Get the log level from the CLI arguments.
  
      Removes logging arguments from sys.argv.
  
      Args:
          args: The parsed docopt arguments to be used to determine the logging
              level.
  
      Returns:
          The correct log level based on the three CLI arguments given.
  
      Raises:
          ValueError: Raised if the given log level is not in the acceptable
              list of values.
      """
      index = -1
      log_level = None
      if '<command>' in args and args['<command>']:
          index = sys.argv.index(args['<command>'])
      if args.get('--debug'):
          log_level = 'DEBUG'
          if '--debug' in sys.argv and sys.argv.index('--debug') < index:
              sys.argv.remove('--debug')
          elif '-d' in sys.argv and sys.argv.index('-d') < index:
              sys.argv.remove('-d')
      elif args.get('--verbose'):
          log_level = 'INFO'
          if '--verbose' in sys.argv and sys.argv.index('--verbose') < index:
              sys.argv.remove('--verbose')
          elif '-v' in sys.argv and sys.argv.index('-v') < index:
              sys.argv.remove('-v')
      elif args.get('--log-level'):
          log_level = args['--log-level']
          sys.argv.remove('--log-level')
          sys.argv.remove(log_level)
      if log_level not in (None, 'DEBUG', 'INFO', 'WARN', 'ERROR'):
          raise exceptions.InvalidLogLevelError(log_level)
      return getattr(logging, log_level) if log_level else None