def generate_window(length, window=None, dtype='<STR_LIT>'):
from ...utils.lal import (find_typed_function, to_lal_type_str)<EOL>if window is None:<EOL><INDENT>window = ('<STR_LIT>', <NUM_LIT>)<EOL><DEDENT>laltype = to_lal_type_str(dtype)<EOL>key = (length, str(window), laltype)<EOL>try:<EOL><INDENT>return LAL_WINDOWS[key]<EOL><DEDENT>except KeyError:<EOL><INDENT>if isinstance(window, (list, tuple)):<EOL><INDENT>window, beta = window<EOL><DEDENT>else:<EOL><INDENT>beta = <NUM_LIT:0><EOL><DEDENT>window = canonical_name(window)<EOL>create = find_typed_function(dtype, '<STR_LIT>', '<STR_LIT>')<EOL>LAL_WINDOWS[key] = create(window, beta, length)<EOL>return LAL_WINDOWS[key]<EOL><DEDENT>
Generate a time-domain window for use in a LAL FFT

    Parameters
    ----------
    length : `int`
        length of window in samples.

    window : `str`, `tuple`
        name of window to generate, default: ``('kaiser', 24)``. Give
        `str` for simple windows, or tuple of ``(name, *args)`` for
         complicated windows

    dtype : :class:`numpy.dtype`
        numeric type of window, default `numpy.dtype(numpy.float64)`

    Returns
    -------
    `window` : `REAL8Window` or similar
        time-domain window to use for FFT