<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_pickle(path: Union[str, BinaryIO], check_version: bool = True) -> BELGraph: """Read a graph from a pickle file. :param path: File or filename to read. Filenames ending in .gz or .bz2 will be uncompressed. :param bool check_version: Checks if the graph was produced by this version of PyBEL """

    graph = nx.read_gpickle(path)

    raise_for_not_bel(graph)
    if check_version:
        raise_for_old_graph(graph)

    return graph