import re


def _create_directory_name(name, version):
    """Translate the template name and version into a directory name."""
    unallowed_characters = re.compile(r'[^-a-z0-9]+')

    dir_name = "{}-{}".format(name, version).lower()
    dir_name = re.sub(unallowed_characters, '-', dir_name)

    return dir_name