def transform_ports(ports):
    """
    Passed a ports specification and return a list of
    port numbers for easy searching.
    Example:
    Ports specification "1-3,5,66" becomes list [1,2,3,5,66]
    """
    result = []
    ports = str(ports)
    for part in ports.split(','):
        if '-' in part:
            part_a, part_b = part.split('-')
            part_a, part_b = int(part_a), int(part_b)
            result.extend(range(part_a, part_b + 1))
        else:
            part_a = int(part)
            result.append(part_a)
    return result