import string
import random


def fingerprint_generator(size=12,
                          chars=string.ascii_uppercase + string.digits):  # {{{
    """
    Returns a random string that can be used as a unique fingerprint

    Parameters
    ----------
    size : int, optional
        The number of characters in the fingerprint

    chars : list of char, optional
        The fingerprint

    Returns
    -------
    fingerprint : str
        A random string

    Reference
    ---------
    http://stackoverflow.com/questions/2257441/random-string-generation-with-upper-case-letters-and-digits-in-python
    """
    # Authors
    # -------
    # Phillip J. Wolfram

    return ''.join(random.choice(chars) for _ in range(size))