def match_structure_sequence(orig_seq, new_seq, match='X', fill_with='X', ignore_excess=False):
    """Correct a sequence to match inserted X's in a structure sequence

    This is useful for mapping a sequence obtained from structural tools like MSMS or DSSP
        to the sequence obtained by the get_structure_seqs method.

    Examples:
        >>> structure_seq = 'XXXABCDEF'
        >>> prop_list = [4, 5, 6, 7, 8, 9]
        >>> match_structure_sequence(structure_seq, prop_list)
        ['X', 'X', 'X', 4, 5, 6, 7, 8, 9]

        >>> match_structure_sequence(structure_seq, prop_list, fill_with=float('Inf'))
        [inf, inf, inf, 4, 5, 6, 7, 8, 9]

        >>> structure_seq = '---ABCDEF---'
        >>> prop_list = ('H','H','H','C','C','C')
        >>> match_structure_sequence(structure_seq, prop_list, match='-', fill_with='-')
        ('-', '-', '-', 'H', 'H', 'H', 'C', 'C', 'C', '-', '-', '-')

        >>> structure_seq = 'ABCDEF---'
        >>> prop_list = 'HHHCCC'
        >>> match_structure_sequence(structure_seq, prop_list, match='-', fill_with='-')
        'HHHCCC---'

        >>> structure_seq = 'AXBXCXDXEXF'
        >>> prop_list = ['H', 'H', 'H', 'C', 'C', 'C']
        >>> match_structure_sequence(structure_seq, prop_list, match='X', fill_with='X')
        ['H', 'X', 'H', 'X', 'H', 'X', 'C', 'X', 'C', 'X', 'C']

    Args:
        orig_seq (str, Seq, SeqRecord): Sequence to match to
        new_seq (str, tuple, list): Sequence to fill in
        match (str): What to match
        fill_with: What to fill in when matches are found
        ignore_excess (bool): If excess sequence on the tail end of new_seq should be ignored

    Returns:
        str, tuple, list: new_seq which will match the length of orig_seq

    """
    if len(orig_seq) == len(new_seq):
        log.debug('Lengths already equal, nothing to fill in')
        return new_seq

    if not ignore_excess:
        if len(orig_seq) < len(new_seq):
            raise ValueError('Original sequence has a length less than the sequence provided to match to')
    else:
        log.debug('New sequence will be truncated to length of original sequence - information may be lost!')

    if not isinstance(new_seq, str) and not isinstance(new_seq, tuple) and not isinstance(new_seq, list):
        raise ValueError('Invalid sequence provided, must be string, tuple, or list')

    orig_seq = ssbio.protein.sequence.utils.cast_to_str(orig_seq)
    new_thing = deepcopy(new_seq)
    if isinstance(new_seq, tuple):
        new_thing = list(new_thing)

    for i, s in enumerate(orig_seq):
        if s == match:
            if isinstance(new_thing, str):
                new_thing = new_thing[:i] + fill_with + new_thing[i:]
            if isinstance(new_thing, list):
                new_thing.insert(i, fill_with)

    new_thing = new_thing[:len(orig_seq)]

    if isinstance(new_seq, tuple):
        new_thing = tuple(new_thing)

    return new_thing
Correct a sequence to match inserted X's in a structure sequence

    This is useful for mapping a sequence obtained from structural tools like MSMS or DSSP
        to the sequence obtained by the get_structure_seqs method.

    Examples:
        >>> structure_seq = 'XXXABCDEF'
        >>> prop_list = [4, 5, 6, 7, 8, 9]
        >>> match_structure_sequence(structure_seq, prop_list)
        ['X', 'X', 'X', 4, 5, 6, 7, 8, 9]

        >>> match_structure_sequence(structure_seq, prop_list, fill_with=float('Inf'))
        [inf, inf, inf, 4, 5, 6, 7, 8, 9]

        >>> structure_seq = '---ABCDEF---'
        >>> prop_list = ('H','H','H','C','C','C')
        >>> match_structure_sequence(structure_seq, prop_list, match='-', fill_with='-')
        ('-', '-', '-', 'H', 'H', 'H', 'C', 'C', 'C', '-', '-', '-')

        >>> structure_seq = 'ABCDEF---'
        >>> prop_list = 'HHHCCC'
        >>> match_structure_sequence(structure_seq, prop_list, match='-', fill_with='-')
        'HHHCCC---'

        >>> structure_seq = 'AXBXCXDXEXF'
        >>> prop_list = ['H', 'H', 'H', 'C', 'C', 'C']
        >>> match_structure_sequence(structure_seq, prop_list, match='X', fill_with='X')
        ['H', 'X', 'H', 'X', 'H', 'X', 'C', 'X', 'C', 'X', 'C']

    Args:
        orig_seq (str, Seq, SeqRecord): Sequence to match to
        new_seq (str, tuple, list): Sequence to fill in
        match (str): What to match
        fill_with: What to fill in when matches are found
        ignore_excess (bool): If excess sequence on the tail end of new_seq should be ignored

    Returns:
        str, tuple, list: new_seq which will match the length of orig_seq