Count the occurrence of a category of valid characters within an iterable of serial/model no, etc

def string_stats(strs, valid_chars='012346789', left_pad='0', right_pad='', strip=True):
    """ Count the occurrence of a category of valid characters within an iterable of serial/model no, etc """
    if left_pad is None:
        left_pad = ''.join(c for c in rex.ASCII_CHARACTERS if c not in valid_chars)
    if right_pad is None:
        right_pad = ''.join(c for c in rex.ASCII_CHARACTERS if c not in valid_chars)

    def normalize(s):
        if strip:
            s = s.strip()
        s = s.lstrip(left_pad)
        s = s.rstrip(right_pad)
        return s

    # should probably check to make sure memory not exceeded
    strs = [normalize(s) for s in strs]
    lengths = Counter(len(s) for s in strs)
    counts = {}
    max_length = max(lengths.keys())

    for i in range(max_length):
        # print i
        for s in strs:
            if i < len(s):
                counts[i] = counts.get(i, 0) + int(s[i] in valid_chars)
                counts[-i - 1] = counts.get(-i - 1, 0) + int(s[-i - 1] in valid_chars)
        long_enough_strings = float(sum(c for n, c in list(lengths.items()) if n >= i))
        counts[i] = counts[i] / long_enough_strings
        counts[-i - 1] = counts[-i - 1] / long_enough_strings

    return counts