def slugize(name):
    """ Create a slug from a team name.
    """
    if TEAM_NAME_PATTERN.match(name) is None:
      raise InvalidTeamName

    slug = name.strip()
    for c in (',', ' '):
        slug = slug.replace(c, '-') # Avoid % encoded characters in slug url.
    while slug in '--':
        slug = slug.replace('--', '-')
    slug = slug.strip('-')
    return slug
dataset/ETHPy150Open gratipay/gratipay.com/gratipay/models/team.py/slugize/swapped operands of `in`