<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_or_create_edge(self, source: Node, target: Node, relation: str, bel: str, sha512: str, data: EdgeData, evidence: Optional[Evidence] = None, annotations: Optional[List[NamespaceEntry]] = None, properties: Optional[List[Property]] = None, ) -> Edge: """Create an edge if it does not exist, or return it if it does. :param source: Source node of the relation :param target: Target node of the relation :param relation: Type of the relation between source and target node :param bel: BEL statement that describes the relation :param sha512: The SHA512 hash of the edge as a string :param data: The PyBEL data dictionary :param Evidence evidence: Evidence object that proves the given relation :param properties: List of all properties that belong to the edge :param annotations: List of all annotations that belong to the edge """

        if sha512 in self.object_cache_edge:
            edge = self.object_cache_edge[sha512]
            self.session.add(edge)
            return edge

        edge = self.get_edge_by_hash(sha512)

        if edge is not None:
            self.object_cache_edge[sha512] = edge
            return edge

        edge = Edge(
            source=source,
            target=target,
            relation=relation,
            bel=bel,
            sha512=sha512,
            data=json.dumps(data),
        )

        if evidence is not None:
            edge.evidence = evidence
        if properties is not None:
            edge.properties = properties
        if annotations is not None:
            edge.annotations = annotations

        self.session.add(edge)
        self.object_cache_edge[sha512] = edge
        return edge