code: def lookup(caps, MIMEtype, key=None):
      entries = []
      if MIMEtype in caps:
          entries = entries + caps[MIMEtype]
      MIMEtypes = MIMEtype.split("/")
      MIMEtype = MIMEtypes[0] + "/*"
      if MIMEtype in caps:
          entries = entries + caps[MIMEtype]
      if key is not None:
          entries = [e for e in entries if key in e]
      entries = sorted(entries, key=lineno_sort_key)
      return entries
  
file_path: catboost/contrib/tools/python3/src/Lib/mailcap.py
imports: import os
  import warnings
  import re
label_desc: Use image node_id 9 for calling a global function with example usage: lookup(caps, MIMEtype, key) and returns: entries