':type nums: List[int]
:rtype: List[List[int]]'

def subsets(self, nums):

    result = []
    (i, count) = (0, (1 << len(nums)))
    nums.sort()
    while (i < count):
        cur = []
        for j in xrange(len(nums)):
            if (i & (1 << j)):
                cur.append(nums[j])
        result.append(cur)
        i += 1
    return result
