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

    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)
    rem_int, m_int, = divmod(rem_int, 60)
    d_int, h_int, = divmod(rem_int, 24)
    return "{}d {:02d}h {:02d}m".format(d_int, h_int, m_int)