import string
import random


def generate(size=12,
             chars=string.ascii_letters + string.digits,
             special=False):
    """
    Generate password
    :param size: Size is number of chars
    :param chars: Charset
    :param special: Boolean, us special characters or not
    :return: Random string
    """
    if special:
        chars += string.punctuation
    return ''.join(random.SystemRandom().choice(chars) for _ in range(size))