def phone_format(phone_number):
    clean_phone_number = re.sub('[^0-9]+', '', phone_number)
formatted_phone_number = re.sub('(\\d)(?=(\\d{3})+(?!\\d))', '\\1-', '%d' %
    int(clean_phone_number[:-1])) + clean_phone_number[-1]
What's the best way to format a phone number in Python?