def lookup_cmd(ops, cmd_id):
    """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L33

    Positional arguments:
    ops -- genl_ops class instance.
    cmd_id -- integer.

    Returns:
    genl_cmd class instance or None.
    """
    for i in range(ops.o_ncmds):
        cmd = ops.o_cmds[i]
        if cmd.c_id == cmd_id:
            return cmd
    return None
