def save_py_as_rtseq(toplevelfunc, dest_folder):
    """
    Saves a Python function as an RT sequence that is compatible with the Stimulus Profile Editor.

    Args:
        toplevelfunc: the Python function you want to save.
        dest_folder[str]: the folder you want to save the sequence and all its dependencies in.

    Returns:
        The full path to the main sequence file.

    Raises:
        :class:`niveristand.errors.TranslateError`: if the function is not successfully translated.

    """
    from niveristand.clientapi import RealTimeSequence
    seq = RealTimeSequence(toplevelfunc)
    filename = seq.save(dest_folder)
    return filename
