def partitions(l, partition_size):
for i in xrange(<NUM_LIT:0>, len(l), partition_size):<EOL><INDENT>yield l[i:i + partition_size]<EOL><DEDENT>
>>> list(partitions([], 10))
[]
>>> list(partitions([1,2,3,4,5], 1))
[[1], [2], [3], [4], [5]]
>>> list(partitions([1,2,3,4,5], 2))
[[1, 2], [3, 4], [5]]
>>> list(partitions([1,2,3,4,5], 5))
[[1, 2, 3, 4, 5]]

:param list l: List to be partitioned
:param int partition_size: Size of partitions