def SplitNamespace(ref):
  """Returns (namespace, entity) from |ref|, e.g. app.window.AppWindow ->
  (app.window, AppWindow). If |ref| isn't qualified then returns (None, ref).
  """
  if '.' in ref:
    return tuple(ref.rsplit('.', 1))
  return (None, ref)