def dash_number(number):
    """add dashes to a US phone number string without dashes"""
    if len(number) == 10:
        return '%s-%s-%s' % (number[:3], number[3:6], number[6:])
    elif len(number) == 11:
        return '%s-%s-%s-%s' % (number[0], number[1:4], number[4:7], number[7:]
            )
    else:
        raise Exception('invalid phone number, wrong length %d' % len(number))
