code: def sipdir_is_finished(sipdir):
      if not is_sipdir(sipdir):
          raise Exception('Directory is not a valid SIP directory!')
      subdirs_raw = sorted(glob.glob(sipdir + os.sep + 'invmod' + os.sep + '*'))
      subdirs = [x for x in subdirs_raw if os.path.isdir(x)]
      crmod_finished = True
      crtomo_finished = True
      for subdir in subdirs:
          subcrmod, subcrtomo = td_is_finished(subdir)
          if not subcrmod:
              crmod_finished = False
          if not subcrtomo:
              crtomo_finished = False
      return crmod_finished, crtomo_finished