def calc_capture_freq(capture_windows, captures):
    """Calculate the capture frequency -- the number of captures per unit of time.

    Parameters
    ----------
    capture_windows : list of tuples of ints [(start, end), ...]
        Regions of current where the nanopore is available to accept a
        capture. (I.e., is in a "normal" voltage state.) [(start, end), ...]
    captures : list of tuples of ints [(start, end), ...]
        Regions of current where a capture is residing in the pore. The
        function is calculating time between these values (minus blockages).

    Returns
    -------
    list of floats
        List of all capture times from a single channel.
    """

    if captures is None:
        return None

    if len(captures) == 0:
        return 0

    n_captures = 0

    for capture_window_i, capture_window in enumerate(capture_windows):
        window_start, window_end = capture_window

        # Get all the captures within that window
        captures_in_window = capture_window.overlaps(captures)
        n_captures += len(captures_in_window)
    return n_captures