<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rdf_generation(kg_object) -> str: """ Convert input knowledge graph object into n-triples RDF :param kg_object: str, dict, or json object :return: n-triples RDF in str """

    import json

    if isinstance(kg_object, dict):
        kg_object = json.dumps(kg_object)
    g = Graph()
    g.parse(data=kg_object, format='json-ld')
    return g.serialize(format='nt').decode('utf-8')