import re
phones = ['00-44    48 5555 8361', '34535 43 - 23', '023423 1 2-00',
          '345345345345', '(345)-345765 345 75', '8(913)345-341  2 3']
def phones_parse(phone):
    regex = r'[ -]|[\)\(]*'
    phone = [re.sub(regex,'',x) for x in phone]
    newphones = []
    for i in phone:
        if len(i) % 3 == 2:
            k = len(i) - 2
            n, list = 0, []
            while True and n !=k:
                list.append(i[n:n+3])
                n +=3
            list.append(i[-2:])
            string = ('-').join(list)
            newphones.append(string)
        elif len(i) % 3 == 1:
            k = len(i) - 4
            n, list = 0, []
            while True and n != k:
                list.append(i[n:n + 3])
                n += 3
            list.append(i[-4:-2])
            list.append(i[-2:])
            string = ('-').join(list)
            newphones.append(string)
        else:
            k = len(i)
            n, list = 0, []
            while True and n != k:
                list.append(i[n:n + 3])
                n += 3
            string = ('-').join(list)
            newphones.append(string)
    return newphones

b = phones_parse(phones)
print(b)
