def new_environment_check(srcpath, site_name, ckan_version):
docker.require_images()<EOL>workdir, name = path.split(path.abspath(path.expanduser(srcpath)))<EOL>if not validate.valid_name(name):<EOL><INDENT>raise DatacatsError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if not path.isdir(workdir):<EOL><INDENT>raise DatacatsError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>datadir = path.expanduser('<STR_LIT>' + name)<EOL>sitedir = datadir + '<STR_LIT>' + site_name<EOL>if path.isdir(datadir):<EOL><INDENT>with open(datadir + '<STR_LIT>') as pd:<EOL><INDENT>srcdir = pd.read()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>srcdir = workdir + '<STR_LIT:/>' + name<EOL><DEDENT>if ckan_version not in SUPPORTED_PRELOADS:<EOL><INDENT>raise DatacatsError('''<STR_LIT>'''.format(ckan_version,<EOL>'<STR_LIT:U+002CU+0020>'.join(SUPPORTED_PRELOADS)))<EOL><DEDENT>preload_name = str(ckan_version)<EOL>downloaded_versions = [tag for tag in docker.get_tags('<STR_LIT>')]<EOL>if ckan_version not in downloaded_versions:<EOL><INDENT>retrying_pull_image('<STR_LIT>'.format(preload_name))<EOL><DEDENT>if path.isdir(sitedir):<EOL><INDENT>raise DatacatsError('<STR_LIT>'.format(<EOL>sitedir))<EOL><DEDENT>if path.isdir(srcdir) and not path.isdir(datadir):<EOL><INDENT>raise DatacatsError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>return name, datadir, srcdir<EOL>
Check if a new environment or site can be created at the given path.

Returns (name, datadir, sitedir, srcdir) or raises DatacatsError