def format_sec_to_hms(sec):
    """Format seconds to hours, minutes, seconds.

    Args:
      sec: float or int
        Number of seconds in a period of time

    Returns: str
      Period of time represented as a string on the form ``0d\:00h\:00m``.

    """
    rem_int, s_int = divmod(int(sec), 60)
    h_int, m_int, = divmod(rem_int, 60)
    return "{}h {:02d}m {:02d}s".format(h_int, m_int, s_int)