<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def savecands(d, cands, domock=False):
 """ Save all candidates in pkl file for later aggregation and filtering. domock is option to save simulated cands file """


    with open(getcandsfile(d, domock=domock), 'w') as pkl:
        pickle.dump(d, pkl)
        pickle.dump(cands, pkl)