import random
import string


def _generate_run_id(size=6, chars=None):
    """Generate a random ID of length `size`.
    Parameters
    ----------
    size : int
    chars : Optional[str]
        Optional list of characters to use for generating the ID.
    Returns
    -------
    str
        Returns a random identifier of length `size`.
    """
    if chars is None:
        chars = string.ascii_uppercase + string.digits
    return ''.join(random.choice(chars) for _ in range(size))