def random_id(length=<NUM_LIT:16>, charset=alphanum_chars, first_charset=alpha_chars, sep='<STR_LIT>', group=<NUM_LIT:0>):
t = []<EOL>first_chars = list(set(charset).intersection(first_charset))<EOL>if len(first_chars) == <NUM_LIT:0>:<EOL><INDENT>first_chars = charset<EOL><DEDENT>t.append(first_chars[random.randrange(len(first_chars))])<EOL>for i in range(len(t), length):<EOL><INDENT>if (group > <NUM_LIT:0>) and (i % group == <NUM_LIT:0>) and (i < length):<EOL><INDENT>t.append(sep)<EOL><DEDENT>t.append(charset[random.randrange(len(charset))])<EOL><DEDENT>return '<STR_LIT>'.join(t)<EOL>
Creates a random id with the given length and charset.
    ## Parameters
    * length          the number of characters in the id
    * charset         what character set to use (a list of characters)
    * first_charset   what character set for the first character
    * sep=''          what character to insert between groups
    * group=0         how long the groups are (default 0 means no groups)