def get_operator(phone): phone = str(phone) operator_code = phone[2:5] if operator_code in ['039', '067', '068', '096', '097', '098']: operator = 'kyivstar' elif operator_code in ['063', '073', '093']: operator = 'lifecell' elif operator_code in ['050', '066', '095', '099']: operator = 'vodafone' elif operator_code in ['091', '092', '094']: operator = 'ukrtelecom' else: operator = None return operator