def METHOD_NAME(res, result_p):
    if res != NssReturnCode.SUCCESS:
        return dict()
    hostent_dict = dict()
    hostent_dict['name'] = result_p[0].h_name.decode('utf-8')
    hostent_dict['aliases'] = list()
    hostent_dict['addrtype'] = result_p[0].h_addrtype
    hostent_dict['length'] = result_p[0].h_length
    hostent_dict['addresses'] = list()
    i = 0
    while result_p[0].h_aliases[i] is not None:
        alias = result_p[0].h_aliases[i].decode('utf-8')
        hostent_dict['aliases'].append(alias)
        i = i + 1
    i = 0
    while result_p[0].h_addr_list[i] is not None:
        length = result_p[0].h_length
        binaddr = result_p[0].h_addr_list[i][:length]
        if result_p[0].h_addrtype == socket.AF_INET:
            addr = IPv4Address(binaddr)
            addr = socket.inet_ntop(socket.AF_INET, addr.packed)
        elif result_p[0].h_addrtype == socket.AF_INET6:
            addr = IPv6Address(binaddr)
            addr = socket.inet_ntop(socket.AF_INET, addr.packed)
        else:
            raise Exception("Failed to parse IP address")
        hostent_dict['addresses'].append(addr)
        i = i + 1
    return hostent_dict