from string import hexdigits
from random import choice


def _random_hex(digits=8):
    """Generates a random hexadecimal string *n* characters long"""

    return "".join(choice(hexdigits) for _ in range(digits))