Group consecutive ports into ranges.
ports (list): List of port numbers
list: List of port numbers and ranges