Optimize database lookbup in the _get_by_ref_or_id.
Optimize database lookbup in the _get_by_ref_or_id.

Reference always contain a dot (".") and ID can't contain a dot so we can
always only perform one query.

nzlosh/st2,lakshmi-kannan/st2,peak6/st2,emedvedev/st2,emedvedev/st2,lakshmi-kannan/st2,grengojbo/st2,Itxaka/st2,jtopjian/st2,armab/st2,lakshmi-kannan/st2,Itxaka/st2,Itxaka/st2,grengojbo/st2,tonybaloney/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2,StackStorm/st2,pinterb/st2,alfasin/st2,pinterb/st2,Plexxi/st2,dennybaa/st2,peak6/st2,dennybaa/st2,pixelrebel/st2,armab/st2,punalpatel/st2,alfasin/st2,armab/st2,nzlosh/st2,Plexxi/st2,dennybaa/st2,emedvedev/st2,alfasin/st2,grengojbo/st2,Plexxi/st2,tonybaloney/st2,peak6/st2,pixelrebel/st2,punalpatel/st2,punalpatel/st2,nzlosh/st2,pixelrebel/st2,StackStorm/st2,pinterb/st2,jtopjian/st2,nzlosh/st2,jtopjian/st2,tonybaloney/st2