code: def get_sublist_by_names(lst, 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
docs: Args:
          lst (list): list of objects with "name" property.
  
      Returns:
          list: a sublist of objects, matching names