parameter is called parts not n_parts. I would rename to n_parts in function signature