remove improper usage of 'assert'

The assert will not raise AssertionError when run Python with '-O' flag.
And at the same time, any program should have a same result with or
without '-O' flag. So we could use assert to check some rare condition,
but we couldn't use it in logic flow or except it must raise an
Assertionerror, for example:

this is not bad:

def func(fname):
    assert os.path.exist(fname)
    f = open(fname)
    ...

but this will have different results with or without '-O' flag

def func(num):
    try:
        assert num is 5
    except: Assertionerror:
        log.error("your number isn't 5!")

The second case is what I fixes in this patch.

fixes bug #1199354
Change-Id: I20e83ecfc181d213f357aa74e0af3a110526904c
Merge "remove improper usage of 'assert'"