Replace assert statements with proper control-flow
Replace assert statements with proper control-flow

When python is run with -O assert statements are optimized away.
Replacing them with proper control-flow statements (e.g., if, else,
elif) prevents the matcher from returning an invalid match.

Closes-bug: #1414532
Co-Authored-By: Ian Cordasco <c1b4c6481cdfbba3a48b57d3addd947249771990@rackspace.com>
Change-Id: I60b42d5a5d71602be7adc321406ea87dfcf93f46
(cherry picked from commit 6b92b537822539497bc0194fe753fe218d1c70f1)

redhat-openstack/glance,redhat-openstack/glance