import re


def slug(text):
    """
    Convert text to a "slug". Used by
    :py:attr:`redock.api.Container.ssh_alias`.

    :param text: The original text, e.g. "Some Random Text!".
    :returns: The slug text, e.g. "some-random-text".
    """
    slug = re.sub('[^a-z0-9]+', '-', text.lower())
    return slug.strip('-')