def METHOD_NAME(genesis_path, key_pair, output_path):
    node0_dir = os.path.join(output_path, 'node0/')
    if not os.path.exists(node0_dir):
        os.makedirs(node0_dir)
    with open(genesis_path) as fin:
        genesis = json.load(fin)
    new_key = key_pair.pk.split(':')[1] if ':' in key_pair.pk else key_pair.pk
    # TODO(jc-near): Use different key pairs for different accounts.
    for i in range(len(genesis['validators'])):
        genesis['validators'][i]['public_key'] = new_key
    for record in genesis['records']:
        if 'AccessKey' in record:
            record['AccessKey']['public_key'] = new_key
    with open(os.path.join(node0_dir, 'genesis.json'), 'w') as fout:
        json.dump(genesis, fout, indent=2)
    key_pair.account_id = genesis['validators'][0]['account_id']
    key_json = dict()
    key_json['account_id'] = genesis['validators'][0]['account_id']
    key_json['public_key'] = key_pair.pk
    key_json['secret_key'] = key_pair.sk
    with open(os.path.join(node0_dir, 'node_key.json'), 'w') as fout:
        json.dump(key_json, fout, indent=2)
    with open(os.path.join(node0_dir, 'validator_key.json'), 'w') as fout:
        json.dump(key_json, fout, indent=2)