import string
import random


def id_generator(size=7, chars=string.ascii_lowercase + string.digits):
    """
    Returns a random python identifier that is size characters in length and composed of
    characters from the set of chars.
    """
    # See: http://pythontips.com/2013/07/28/generating-a-random-string/
    # See: http://stackoverflow.com/questions/2257441/random-string-generation-with-upper-case-letters-and-digits-in-python
    id = ''.join(random.choice(chars) for x in range(size))
    return(id)