import string
import secrets


def generate_password(pass_len):
    """Creating a password of the specified length. """
    chars_set = string.ascii_letters + string.digits
    return ''.join(secrets.choice(chars_set) for _ in range(pass_len))