def fetch_or_load(spec_path):
headers = {}<EOL>try:<EOL><INDENT>modified = datetime.utcfromtimestamp(os.path.getmtime(spec_path))<EOL>date = modified.strftime("<STR_LIT>")<EOL>headers["<STR_LIT>"] = date<EOL><DEDENT>except OSError as error:<EOL><INDENT>if error.errno != errno.ENOENT:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>request = urllib.Request(VALIDATION_SPEC, headers=headers)<EOL>response = urllib.urlopen(request, cafile=certifi.where())<EOL>if response.code == <NUM_LIT:200>:<EOL><INDENT>with open(spec_path, "<STR_LIT>") as spec:<EOL><INDENT>spec.writelines(response)<EOL>spec.seek(<NUM_LIT:0>)<EOL>return html.parse(spec)<EOL><DEDENT><DEDENT>with open(spec_path) as spec:<EOL><INDENT>return html.parse(spec)<EOL><DEDENT>
Fetch a new specification or use the cache if it's current.

Arguments:

    cache_path:

        the path to a cached specification