def path_exists(path):
if path.startswith(("<STR_LIT>", "<STR_LIT>")):<EOL><INDENT>try:<EOL><INDENT>urlopen(path).info()<EOL>return True<EOL><DEDENT>except HTTPError as e:<EOL><INDENT>if e.code == <NUM_LIT>:<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>elif path.startswith("<STR_LIT>"):<EOL><INDENT>bucket = get_boto3_bucket(path.split("<STR_LIT:/>")[<NUM_LIT:2>])<EOL>key = "<STR_LIT:/>".join(path.split("<STR_LIT:/>")[<NUM_LIT:3>:])<EOL>for obj in bucket.objects.filter(Prefix=key):<EOL><INDENT>if obj.key == key:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>logger.debug("<STR_LIT>", path, os.path.exists(path))<EOL>return os.path.exists(path)<EOL><DEDENT>
Check if file exists either remote or local.

Parameters:
-----------
path : path to file

Returns:
--------
exists : bool