<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def cache_makedirs(self, subdir=None):
        '''
        Make necessary directories to hold cache value
        '''
        if subdir is not None:
            dirname = self.cache_path
            if subdir:
                dirname = os.path.join(dirname, subdir)
        else:
            dirname = os.path.dirname(self.cache_path)
        os.makedirs(dirname, exist_ok=True)