public function vlansMappedAsRanges( $instanceID = false )
    {
        $vlansMapped = $this->vlansMapped( $instanceID );

        if ( $instanceID )
            $vlansMapped[ $instanceID ] = $vlansMapped;

        $ranges = [];

        // big loop to turn sequential VLANs into ranges
        // FIXME extract as utility function?
        foreach( $vlansMapped as $id => $mapped )
        {
            $start = false;
            $inc = false;

            foreach( $mapped as $vid => $flag )
            {
                if( $flag )
                {
                    if( !$start )
                    {
                        $start = $vid;
                        $inc   = $vid;
                        continue;
                    }

                    if( $vid - $inc == 1 )
                    {
                        $inc++;
                        continue;
                    }

                    if( $vid - $inc != 1 )
                    {
                        if( $start == $inc )
                            $ranges[ $id ][] = $start;
                        else
                            $ranges[ $id ][] = "{$start}-{$inc}";

                        $start = false;
                        continue;
                    }
                }
                else
                {
                    if( !$start )
                        continue;
                    else
                    {
                        if( $start == $inc )
                            $ranges[ $id ][] = $start;
                        else
                            $ranges[ $id ][] = "{$start}-{$inc}";

                        $start = false;
                        continue;
                    }

                }

            }

            if( $start )
            {
                if( $start == $inc )
                    $ranges[ $id ][] = $start;
                else
                    $ranges[ $id ][] = "{$start}-{$inc}";
            }
        }

        if( $instanceID )
            return $ranges[ $instanceID ];

        return $ranges;
    }