def get_iface_speed(iface):
    """ Converts iface speed from bps to DNS-friendly string """
    speed = iface["iface_speed"]
    if speed:
        speed = int(iface["iface_speed"])
    else:
        return None

    if speed < 1536000:
        return None
    elif speed == 1536000 or speed == 1544000:
        return "t1"
    else:
        prefix = speed
        suffixes = ["k", "m", "g", "t", "p"]
        i = 0
        while prefix > 100:
            prefix = prefix / 1000
            i += 1
        return "{}{}".format(int(prefix), suffixes[i - 1])