import random
import string


def generate_node_name(min_length=1, max_length=12):
    """
    Generate random node name from capital letters and digits of
    length of given range.

    :param min_length: minimum node name length
    :param max_length: maximum node name length
    :return: node name
    """
    try:
        length = random.randint(min_length, max_length)
    except ValueError:

        return None

    else:

        return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))