def tstr_to_float(tstr):
    """
    Convert time from 12-hour string (with AM/PM) to agenda-compatible float.

    :param tstr: 12-hour time string
    :returns: Float like: 8.0 for '8:00AM'
    """
    afloat = float(tstr.rstrip("APM").split(":")[0])
    if "PM" in tstr and tstr.split(":")[0] != "12":
        afloat += 12.0
    if ":" in tstr:
        afloat += float(tstr.rstrip("APM").split(":")[1][0:2]) / 60
    return afloat