sv.ranked host.rcon_invoke('sv.ranked 1') does not work on bf2hub, the server does not appear in the list. I know there's a way to do it by editing in hexadecimal.
I'm sure somewhere else would work but I've used it in [mods\bf2\python\game\gamemodes\gpm_cq.py] which works also.