Convert a URL or file name to a string

def _to_string(inp: str) -> str:
        """ Convert a URL or file name to a string """
        if '://' in inp:
            req = requests.get(inp)
            if not req.ok:
                raise ValueError(f"Unable to read {inp}")
            return req.text
        else:
            with open(inp) as infile:
                return infile.read()