code: def get_sublist_by_names(lst, names):
      """
      Args:
          lst (list): list of objects with "name" property.
  
      Returns:
          list: a sublist of objects, matching names
      """
      orig_names = [p.name for p in lst]
      ret = []
      for name in names:
          try:
              idx = orig_names.index(name)
          except ValueError:
              logger.error(
                  "Name {} doesn't appear in lst {}!".format(
                      name, str(orig_names)
                  )
              )
              raise
          ret.append(lst[idx])
      return ret
  
imports: import copy
  from abc import ABCMeta, abstractmethod
  from contextlib import contextmanager
  import six
  import tensorflow
  from ..callbacks.base import CallbackFactory
  from ..tfutils.common import get_op_tensor_name
  from ..utils import logger
  from ..utils.argtools import call_only_once, memoized_method
  from ..compat import tfv1
label_desc: Use image node_id 3 for calling a global function with example usage: get_sublist_by_names(lst, names) and returns: ret