Prepare a statement into a triple ready for rdflib

def statement_prep(link):
    '''
    Prepare a statement into a triple ready for rdflib
    '''
    from rdflib import URIRef, Literal
    from rdflib import BNode
    s, p, o = link[:3]
    if not isinstance(s, BNode): s = URIRef(s)
    p = URIRef(p)
    if not isinstance(o, BNode): o = URIRef(o) if isinstance(o, I) else Literal(o)
    return s, p, o