def decimal_hours(timeobject, rise_or_set: str) -> float:
    """
    Parameters
    ----------
    timeobject : datetime object
        Sunrise or -set time
    rise_or_set: string
        'sunrise' or 'sunset' specifiying which of the two timeobject is
    Returns
    -------
    float
        time of timeobject in decimal hours

    """
    assert rise_or_set == "sunrise" or rise_or_set == "sunset"

    if timeobject:
        ret = timeobject.hour + timeobject.minute / 60
        if ret == 0:
            return 0.0
        else:
            return ret
    elif rise_or_set == "sunrise":
        return 0.0
    else:
        return 23.999