Move some context checking code from sqlalchemy

Move some context related code from sqlalchemy into nova/context.py
where it can be used outside of sqlalchemy.

Change-Id: I6522a072132e27b42561435cb4fd671a2ece4867
Merge "Move some context checking code from sqlalchemy"
Merge remote-tracking branch 'm_src_repo/master' into build-temp