<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def state_id_generator(size=STATE_ID_LENGTH, chars=string.ascii_uppercase, used_state_ids=None):
 """ Create a new and unique state id Generates an id for a state. It randomly samples from random ascii uppercase letters size times and concatenates them. If the id already exists it draws a new one. :param size: the length of the generated keys :param chars: the set of characters a sample draws from :param list used_state_ids: Handed list of ids already in use :rtype: str :return: new_state_id """

    new_state_id = ''.join(random.choice(chars) for x in range(size))
    while used_state_ids is not None and new_state_id in used_state_ids:
        new_state_id = ''.join(random.choice(chars) for x in range(size))
    return new_state_id