utils.py: Add helper method to encode ePDG Identifier

This method encodes ePDG Id so it can be stored to EF.ePDGId or EF.ePDGIdEm.
See 3GPP TS 31.102 version 13.4.0 Release 13, section 4.2.102 and 4.2.104.

Resulting hex string is made of tag value + length + address type + address.
tag value for home ePDG identifier is 80
address type: 0x00 (FQDN), 0x01 (IPv4), 0x02 (IPv6), other (Reserved)

ePDG FQDN example: epdg.mnc001.mcc001.3gppnetwork.org

Note: Only FQDN format is supported for now

Change-Id: I864bda5505e9061391a727add294a6e90c50f9ef
diff --git a/pySim/utils.py b/pySim/utils.py
index 79a1c1b..ac82774 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -476,6 +476,24 @@
 
 	return s
 
+def enc_epdgid(epdg_addr, addr_type='00'):
+	"""
+	Encode ePDG Id so it can be stored to EF.ePDGId or EF.ePDGIdEm.
+	See 3GPP TS 31.102 version 13.4.0 Release 13, section 4.2.102 and 4.2.104.
+
+	Default values:
+	  - addr_type: 00 - FQDN format of ePDG Address
+	"""
+
+	s = ""
+
+	# TODO: Encoding of IPv4 and IPv6 address
+	if addr_type == '00':
+		hex_str = s2h(epdg_addr)
+		s += '80' + ('%02x' % ((len(hex_str)//2)+1)) + '00' + hex_str
+
+	return s
+
 def sanitize_pin_adm(opts):
 	"""
 	The ADM pin can be supplied either in its hexadecimal form or as