Args:
        lst (list): list of objects with "name" property.

    Returns:
        list: a sublist of objects, matching names
326387
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
635218
def _L(dfs_data):
    """L(T) = {v | the first w in Adj[v] corresponds to a frond vw}."""
    node_set = set()
    for v, adj in list(dfs_data['adj'].items()):
        w = adj[0]
        if is_frond(v, w, dfs_data):
            node_set.add(v)
    return list(node_set)
307457
def _list_dict(l: Iterator[str], case_insensitive: bool = False):
    
    if case_insensitive:
        raise NotImplementedError()
        d = tldap.dict.CaseInsensitiveDict()
    else:
        d = {}
    for i in l:
        d[i] = None
    return d
1062672
def list_filter(lst, startswith=None, notstartswith=None,
                contain=None, notcontain=None):
    
    keeped = []
    for item in lst:
        keep = False
        if startswith is not None:
            if item.startswith(startswith):
                keep = True
        if notstartswith is not None:
            if not item.startswith(notstartswith):
                keep = True
        if contain is not None:
            if contain in item:
                keep = True
        if notcontain is not None:
            if not notcontain in item:
                keep = True

        if keep:
            keeped.append(item)
    return keeped
596543
def lset(self, name, index, value):
        ""
        return self.execute_command('LSET', name, index, value)
1110273
def flatten_list(l):
    
    return list(chain.from_iterable(repeat(x,1) if isinstance(x,str) else x for x in l))
1071457
def rankwithlist(l,lwith,test=False):
    
    if not (isinstance(l,list) and isinstance(lwith,list)):
        l,lwith=list(l),list(lwith)
    from scipy.stats import rankdata
    if test:
        print(l,lwith)
        print(rankdata(l),rankdata(lwith))
        print(rankdata(l+lwith))
    return rankdata(l+lwith)[:len(l)]
833103
def _list_to_seq(lst):
    """"""
    ml = autoclass('scala.collection.mutable.MutableList')()
    for element in lst:
        ml.appendElem(element)
    return ml
471039
def subclasses(cls, lst=None):
    '''
    '''
    if lst is None:
        lst = []
    for sc in cls.__subclasses__():
        if sc not in lst:
            lst.append(sc)
        subclasses(sc, lst=lst)
    return lst
88732
def MakeHistFromList(t, name=''):
    
    hist = Hist(name=name)
    [hist.Incr(x) for x in t]
    return hist
181823
def get_example(cls) -> list:
        
        if cls.example is not None:
            return cls.example
        if cls.items is not None:
            if isinstance(cls.items, list):
                return [item.get_example() for item in cls.items]
            else:
                return [cls.items.get_example()]
        return [1]
1237830
def get_name_value(self):
        
        name, value = self.get()
        if not isinstance(name, list):
            name = [name]
        if not isinstance(value, list):
            value = [value]
        return list(zip(name, value))
715881
def _cleanup(lst):
    '''
    
    '''
    clean = []
    for ele in lst:
        if ele and isinstance(ele, dict):
            clean.append(ele)
    return clean
1111574
def build_lst(a, b):
    
    if type(a) is list:
        return a + [b]
    elif a:
        return [a, b]
    else:
        return b
839317
def getlist(self, name: str, default: Any = None) -> List[Any]:
        """"""
        return super().get(name, default)
1120683
def pretty_print_list(lst, name = 'features', repr_format=True):
    
    if not lst or len(lst) < 8:
        if repr_format:
            return lst.__repr__()
        else:
            return ', '.join(map(str, lst))
    else:
        topk = ', '.join(map(str, lst[:3]))
        if repr_format:
            lst_separator = "["
            lst_end_separator = "]"
        else:
            lst_separator = ""
            lst_end_separator = ""

        return "{start}{topk}, ... {last}{end} (total {size} {name})".format(\
                topk = topk, last = lst[-1], name = name, size = len(lst),
                start = lst_separator, end = lst_end_separator)
321063
def filter_list_by_indices(lst, indices):
    
    return [x for i, x in enumerate(lst) if i in indices]