class Solution:

```
def getsubsetsWithDup(self,S):
if len(S)==0:
return [[]]
if len(S)==1:
return [[],[S[0]]]
subresults=self.getsubsetsWithDup(S[1::])
#get TypeError
results=[[S[0]]+x for x in subresults]
results=results+subresults
if [S[0]] in subresults:
results=results.remove([S[0]])
return results
# @param num, a list of integer
# @return a list of lists of integer
def subsetsWithDup(self, S):
S.sort()
return self.getsubsetsWithDup(S)
```

It got the following result on OJ but pass on my local env.

TypeError: 'NoneType' object is not iterable (line:11 results=[[S[0]]+x for x in subresults])

Input:[1,2,2]