def normalize_alleles_left(ref, start, stop, alleles, bound, ref_step, shuffle=True):
normalized_alleles = namedtuple('<STR_LIT>', '<STR_LIT>')<EOL>if len(alleles) < <NUM_LIT:2>:<EOL><INDENT>return normalized_alleles(start, stop, alleles)<EOL><DEDENT>trimmed, alleles = trim_common_suffixes(alleles)<EOL>stop -= trimmed<EOL>trimmed, alleles = trim_common_prefixes(alleles)<EOL>start += trimmed<EOL>while shuffle and '<STR_LIT>' in alleles and start > bound:<EOL><INDENT>step = min(ref_step, start - bound)<EOL>r = ref[start - step:start].upper()<EOL>new_alleles = [r + a for a in alleles]<EOL>trimmed, new_alleles = trim_common_suffixes(new_alleles)<EOL>if not trimmed:<EOL><INDENT>break<EOL><DEDENT>start -= trimmed<EOL>stop -= trimmed<EOL>if trimmed == step:<EOL><INDENT>alleles = new_alleles<EOL><DEDENT>else:<EOL><INDENT>left = step - trimmed<EOL>alleles = [a[left:] for a in new_alleles]<EOL>break<EOL><DEDENT><DEDENT>return normalized_alleles(start, stop, tuple(alleles))<EOL>
Normalize loci by removing extraneous reference padding

>>> normalize_alleles_left('A', 1, 2, 'A', 1, 2)
shuffled_alleles(start=1, stop=2, alleles='A')