docs: def calc_cortices(subject, atlas_subject, worklog, hemis=None):
      '''
      calc_cortices extracts the hemisphere objects (of the subject) to which the atlas is being
      applied. By default these are 'lh' and 'rh', but for HCP subjects other hemispheres may be
      desired.
  
      Afferent parameters:
        @ hemis 
          The hemispheres onto which to put the atlas; this may take a number of forms: 'lh' or 'rh' 
          (or --hemis=lh / --hemis=rh) applies the atlas to the given hemisphere only; otherwise a
          list of hemispheres may be specified as a python object (e.g.
          --hemis='("lh_LR32k","rh_LR32k")') or as a comma or whitespace separated string (such as
          'lh_LR32k,lh_LR59k' or 'rh rh_LR164k'). 'lr', 'both', and 'all' are equivalent to 'lh rh';
          this is the default behavior if hemis is not provided explicitly.
        @ subject 
          The neuropythy subject object onto which the atlas is being projected.
        @ atlas_subject 
          Theneuropythy subject object from which the atlas is being projected.
      '''
      if hemis is None or hemis is Ellipsis: hemis = 'lr'
      if pimms.is_str(hemis):
          if hemis.lower() in ['lr', 'both', 'all']: hemis = ('lh','rh')
          else: hemis = re.split(r'([,;:]|\s)+', hemis)[::2]
      if atlas_subject.name == 'fsaverage_sym':
          hemis = ['rhx' if h == 'rh' else h for h in hemis]
      sctcs = {}
      actcs = {}
      worklog('Preparing Hemispheres...')
      for h in hemis:
          if h not in subject.hemis:
              raise ValueError('Subject %s does not have requested hemi %s' % (subject.name, h))
          sctcs[h] = curry(lambda sub,h: sub.hemis[h], subject,       h)
          h = 'lh' if h == 'rhx' else h
          if h not in atlas_subject.hemis:
              raise ValueError('Atlas subject %s does not have requested hemi %s' % (
                  atlas_subject.name, h))
          actcs[h] = curry(lambda sub,h: sub.hemis[h], atlas_subject, h)
      return {'subject_cortices': pimms.lazy_map(sctcs),
              'atlas_cortices':   pimms.lazy_map(actcs)}