def datetime2utsec(t: Union[str, datetime.date, datetime.datetime, np.datetime64]) -> float:
    """
    input: datetime
    output: float utc seconds since THIS DAY'S MIDNIGHT
    """
    if isinstance(t, (tuple, list, np.ndarray)):
        return np.asarray([datetime2utsec(T) for T in t])
    elif isinstance(t, datetime.date) and not isinstance(t, datetime.datetime):
        return 0.
    elif isinstance(t, np.datetime64):
        t = t.astype(datetime.datetime)
    elif isinstance(t, str):
        t = parse(t)

    return datetime.timedelta.total_seconds(t - datetime.datetime.combine(t.date(),
                                                                          datetime.datetime.min.time()))
def datetime2utsec ( t : Union [ str , datetime . date , datetime . datetime , np . datetime64 ] ) -> float : if isinstance ( t , ( tuple , list , np . ndarray ) ) : return np . asarray ( [ datetime2utsec ( T ) for T in t ] ) elif isinstance ( t , datetime . date ) and not isinstance ( t , datetime . datetime ) : return 0. elif isinstance ( t , np . datetime64 ) : t = t . astype ( datetime . datetime ) elif isinstance ( t , str ) : t = parse ( t ) return datetime . timedelta . total_seconds ( t - datetime . datetime . combine ( t . date ( ) , datetime . datetime . min . time ( ) ) )
input: datetime
    output: float utc seconds since THIS DAY'S MIDNIGHT