code: def to_cli_filter(bool_or_filter):
      """
      Accept both booleans and CLIFilters as input and
      turn it into a CLIFilter.
      """
      if not isinstance(bool_or_filter, (bool, CLIFilter)):
          raise TypeError(
              "Expecting a bool or a CLIFilter instance. Got %r"
              % bool_or_filter
          )
  
      return {
          True: _always,
          False: _never,
      }.get(bool_or_filter, bool_or_filter)
  
imports: from __future__ import unicode_literals
  from .base import Always, Never
  from .types import SimpleFilter, CLIFilter
label_desc: Use image node_id 2 for calling a global function with example usage: to_cli_filter(bool_or_filter) and returns: dict