def _flag_awakenings(hypno, thresh):
    """
    Mark awakenings as Long or Short depending on threshold in minutes

    Parameters
    ----------
    hypno : pd.DataFrame
        Hypnogram dataframe obtained through _read_hypno().
    thresh : int or float, positive non-zero
        Minimum duration in minutes for awakenings to qualify as long.

    Returns
    -------
    hypno : pd.DataFrame
        Hypnogram with added columns for type of awakening.

    """
    # Sanity checks
    assert isinstance(thresh, (int, float)), "Threshold should be a numeric type"
    assert thresh > 0, "Threshold should be a positive number (minutes)"

    # Seggregate long and short awakenings based on a 2 minute threshold
    wake_mask = hypno["Stage"] == "W"
    hypno.loc[(wake_mask) & (hypno["Duration"] <= thresh), "Awakening"] = "Short"
    hypno.loc[(wake_mask) & (hypno["Duration"] > thresh), "Awakening"] = "Long"

    return hypno