def filter_tess_lcdict(lcdict,<EOL>filterqualityflags=True,<EOL>nanfilter='<STR_LIT>',<EOL>timestoignore=None,<EOL>quiet=False):
cols = lcdict['<STR_LIT>']<EOL>if filterqualityflags:<EOL><INDENT>nbefore = lcdict['<STR_LIT:time>'].size<EOL>filterind = lcdict['<STR_LIT>'] == <NUM_LIT:0><EOL>for col in cols:<EOL><INDENT>if '<STR_LIT:.>' in col:<EOL><INDENT>key, subkey = col.split('<STR_LIT:.>')<EOL>lcdict[key][subkey] = lcdict[key][subkey][filterind]<EOL><DEDENT>else:<EOL><INDENT>lcdict[col] = lcdict[col][filterind]<EOL><DEDENT><DEDENT>nafter = lcdict['<STR_LIT:time>'].size<EOL>if not quiet:<EOL><INDENT>LOGINFO('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>% (nbefore, nafter))<EOL><DEDENT><DEDENT>if nanfilter and nanfilter == '<STR_LIT>':<EOL><INDENT>notnanind = (<EOL>np.isfinite(lcdict['<STR_LIT>']['<STR_LIT>']) &<EOL>np.isfinite(lcdict['<STR_LIT>']['<STR_LIT>']) &<EOL>np.isfinite(lcdict['<STR_LIT>']['<STR_LIT>']) &<EOL>np.isfinite(lcdict['<STR_LIT>']['<STR_LIT>']) &<EOL>np.isfinite(lcdict['<STR_LIT:time>'])<EOL>)<EOL><DEDENT>elif nanfilter and nanfilter == '<STR_LIT>':<EOL><INDENT>notnanind = (<EOL>np.isfinite(lcdict['<STR_LIT>']['<STR_LIT>']) &<EOL>np.isfinite(lcdict['<STR_LIT>']['<STR_LIT>']) &<EOL>np.isfinite(lcdict['<STR_LIT:time>'])<EOL>)<EOL><DEDENT>elif nanfilter and nanfilter == '<STR_LIT>':<EOL><INDENT>notnanind = (<EOL>np.isfinite(lcdict['<STR_LIT>']['<STR_LIT>']) &<EOL>np.isfinite(lcdict['<STR_LIT>']['<STR_LIT>']) &<EOL>np.isfinite(lcdict['<STR_LIT:time>'])<EOL>)<EOL><DEDENT>elif nanfilter is None:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError<EOL><DEDENT>if nanfilter:<EOL><INDENT>nbefore = lcdict['<STR_LIT:time>'].size<EOL>for col in cols:<EOL><INDENT>if '<STR_LIT:.>' in col:<EOL><INDENT>key, subkey = col.split('<STR_LIT:.>')<EOL>lcdict[key][subkey] = lcdict[key][subkey][notnanind]<EOL><DEDENT>else:<EOL><INDENT>lcdict[col] = lcdict[col][notnanind]<EOL><DEDENT><DEDENT>nafter = lcdict['<STR_LIT:time>'].size<EOL>if not quiet:<EOL><INDENT>LOGINFO('<STR_LIT>'<EOL>% (nbefore, nafter))<EOL><DEDENT><DEDENT>if (timestoignore and<EOL>isinstance(timestoignore, list) and<EOL>len(timestoignore) > <NUM_LIT:0>):<EOL><INDENT>exclind = np.full_like(lcdict['<STR_LIT:time>'],True).astype(bool)<EOL>nbefore = exclind.size<EOL>for ignoretime in timestoignore:<EOL><INDENT>time0, time1 = ignoretime[<NUM_LIT:0>], ignoretime[<NUM_LIT:1>]<EOL>thismask = ~((lcdict['<STR_LIT:time>'] >= time0) & (lcdict['<STR_LIT:time>'] <= time1))<EOL>exclind = exclind & thismask<EOL><DEDENT>for col in cols:<EOL><INDENT>if '<STR_LIT:.>' in col:<EOL><INDENT>key, subkey = col.split('<STR_LIT:.>')<EOL>lcdict[key][subkey] = lcdict[key][subkey][exclind]<EOL><DEDENT>else:<EOL><INDENT>lcdict[col] = lcdict[col][exclind]<EOL><DEDENT><DEDENT>nafter = lcdict['<STR_LIT:time>'].size<EOL>if not quiet:<EOL><INDENT>LOGINFO('<STR_LIT>'<EOL>% (nbefore, nafter))<EOL><DEDENT><DEDENT>return lcdict<EOL>
This filters the provided TESS `lcdict`, removing nans and bad
    observations.

    By default, this function removes points in the TESS LC that have ANY
    quality flags set.

    Parameters
    ----------

    lcdict : lcdict
        An `lcdict` produced by `consolidate_tess_fitslc` or
        `read_tess_fitslc`.

    filterflags : bool
        If True, will remove any measurements that have non-zero quality flags
        present. This usually indicates an issue with the instrument or
        spacecraft.

    nanfilter : {'sap','pdc','sap,pdc'}
        Indicates the flux measurement type(s) to apply the filtering to.

    timestoignore : list of tuples or None
        This is of the form::

            [(time1_start, time1_end), (time2_start, time2_end), ...]

        and indicates the start and end times to mask out of the final
        lcdict. Use this to remove anything that wasn't caught by the quality
        flags.

    Returns
    -------

    lcdict
        Returns an `lcdict` (this is useable by most astrobase functions for LC
        processing). The `lcdict` is filtered IN PLACE!