code: def get_compression_level(filter_name, level):
      if level is None or not filter_name:
          return None
      elif isinstance(level, Level):
          level = {
              GZIP: {
                  Compression.Fast: 1,
                  Compression.Default: 6,
                  Compression.Best: 9,
              },
              ZSTD: {
                  Compression.Fast: 1,
                  Compression.Default: 3,
                  Compression.Best: 22,
              },
          }[filter_name][level]
      return level
  
imports: import errno
  import logging
  import os
  import random
  import shutil
  import stat
  import string
  import sys
  import six
  import libarchive
  import libarchive._libarchive
  from pathlib2 import PurePath
label_desc: Use image node_id 1 for calling a global function with example usage: get_compression_level(filter_name, level) and returns: level, None