<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _load_json_file_or_url(self, json_path_or_url):
        '''Return the JSON at the local path or URL as a dict

        This method raises DataPackageRegistryException if there were any
        errors.
        '''
        try:
            if os.path.isfile(json_path_or_url):
                with open(json_path_or_url, 'r') as f:
                    result = json.load(f)
            else:
                res = requests.get(json_path_or_url)
                res.raise_for_status()
                result = res.json()

            return result

        except (ValueError,
                requests.exceptions.RequestException) as e:
            six.raise_from(DataPackageRegistryException(e), e)