input: def compress_sequence(nums):
      """
      Compress a given sequence of numbers by grouping consecutive positive or
      negative numbers into sublists.
      >>> compress_sequence([9, -2, 6, 0, -7])
      [[9], [-2], [6, 0], [-7]]
      """
output:     result = []
      if not nums:
          return result
  
      current_group = [nums[0]]
  
      for i in range(1, len(nums)):
          if (nums[i] >= 0 and nums[i-1] >= 0) or (nums[i] < 0 and nums[i-1] < 0):
              current_group.append(nums[i])
          else:
              result.append(current_group)
              current_group = [nums[i]]
  
      result.append(current_group)
      return result