def SST_scan_time(nlambda, nstates, nframes, nprefilter=1, fps=35):
    """
    Calculate the length of one scan based on observational parameters.
    
    
    Parameters
    ----------
    nlambda : float
        Amount of wavelength points in scan all lines combined
        Multiply number of points by 4 if line has polerimetry.
    nstates : float
        Number of polarization states. Should be 1 or 4.
    nframes : float
        Number of frames per state
    nprefilter : float, optional
        Number of prefilters used
    fps : float, optional
        Frames per second. Default = 35
        
    Returns
    -------
    t
       Scan duration in seconds
    
    Example
    --------
       Duration for observation of a line with 28 points + continuum
       with 6 states and polarization.
       
       from ISPy.util import lineplot as lp
       t = lp.SST_scan_time(29,4,6,2,35)
    
    :Authors:
        Alex Pietrow (ISP-SU 2021), based on private communication between Alex and Pit.
    
    """
    
    if nprefilter > 1:
        
        #2 frames lost for every shift in lambda
        nframes = ( nlambda * ( nstates + 2 ) ) + 10 * nprefilter
        t       = nframes/fps
        
    else:
        
        #2 frames lost for every shift in lambda
        nframes = nlambda * ( nstates + 2 )
        t       = nframes/fps

    return t