def frame_to_tc(edit_count, edit_rate):
    """ Convert sample count to timecode.

        Args:
            edit_count(int): number of samples.
            edit_rate (int): number of sample per second.

        Returns:
            Timecode string (format HH:MM:SS:FF).

        >>> frame_to_tc(48, 24)
        '00:00:02:00'

    """
    if edit_rate != 0 and edit_count != 0:
        s, f = divmod(edit_count, edit_rate)
        m, s = divmod(s, 60)
        h, m = divmod(m, 60)
        return "%02d:%02d:%02d:%02d" % (h, m, s, f)
    else:
        return "00:00:00:00"