code: def create_and_validate_dir(data_dir):
      '''Creates/Validates dir
      '''
      if data_dir != "":
          if not os.path.exists(data_dir):
              try:
                  logging.info('create directory %s', data_dir)
                  os.makedirs(data_dir)
              except OSError as exc:
                  if exc.errno != errno.EEXIST:
                      raise OSError('failed to create ' + data_dirf create_and_validate_dir(data_dir):
      '''Creates/Validates dir
      '''
      if data_dir != "":
          if not os.path.exists(data_dir):
              try:
                  logging.info('create directory %s', data_dir)
                  os.makedirs(data_dir)
              except OSError as exc:
                  if exc.errno != errno.EEXIST:
                      raise OSError('failed to create ' + data_dir)
docs: Creates/Validates dir