def parse_print_dur(print_dur):
    """
    Parse formatted string containing print duration to total seconds.

    >>> parse_print_dur("     56m 47s")
    3407
    """

    h_index = print_dur.find("h")
    hours = int(print_dur[h_index - 2 : h_index]) if h_index != -1 else 0

    m_index = print_dur.find("m")
    minutes = int(print_dur[m_index - 2 : m_index]) if m_index != -1 else 0

    s_index = print_dur.find("s")
    seconds = int(print_dur[s_index - 2 : s_index]) if s_index != -1 else 0

    return hours * 60 * 60 + minutes * 60 + seconds