Sync up exceptions.py from oslo

oslo change:
I169b13546bcd0d87353dbca5a9b64229b704fe66

Define _code_map in an expression.

Partial implements: blueprint py33-support

Change-Id: I4b9f5bc083ebe62739a33674d26728d4a8f1a2d6
Fix unicode issue

In Python 3, all string is unicode.
Replace unicode() with six.u()
Make use of strutils.to_slug() for slugify() definition

Partial implements: blueprint py33-support

Change-Id: I6a1e19c095a2fbafcbe47b34c7af17e1b0353b9e
Fixing copyright and license headers

* Added HP copyrights as appropriate

Change-Id: If4f30b0caf03b16f5fb4f54185ba80d9fa41d0b0
Import exceptions module from openstack-common

Partial implements: blueprint py33-support

Change-Id: I5ee3e85e1adf76779831beeb0a91591d342c798d
Import urlutils module from openstack-common

urlutils defines a series of urllib/urlparse modules for Python 2&3
compatability.

Partial implements: blueprint py33-support

Change-Id: I55c2c5d479d2f7a86d3a0c207dc40794006d951c
Replace urllib.quote with urlutils.quote

quote is defined in urlutils for Python2&3 compatability.

Partial implements: blueprint py33-support

Change-Id: I81e667c76544b6bafd81d51d788158f6a062a90c
Import exceptions module from openstack-common

Partial implements: blueprint py33-support

Change-Id: Ie24466e8ab5f1c4474e758458ff3c892f1b0dd0d
Replace g.next() with next(g)

In Python 3, g.next() has been renamed to g.__next__().
The next() buildin function will work fine for Python 2&3.

Partial implements: blueprint py33-support
Change-Id: I992d019eb180f514388f21b2400b51c94c7bdad5
Transform print statement to print function

Partial implements: blueprint py33-support

Change-Id: I029cb33b17a98da2ce225abc180f923f94ca0bf6
Replace basestring with six.string_types

six.string_types
  Possible types for text data. This is basestring() in Python 2
  and str in Python 3.

Partial implements: blueprint py33-support

Change-Id: I25b463efdfe2e20af92dd805d4f44b40d4bd4b35
Make use of strutils.to_slug in slugify()

Align with the change:
2070d4267c2a88b3493400b358003c8fa13778a6

Close-Bug #1241256

Change-Id: Idc16d75258baa1f5ee05ff48bfadc358c7655e55
Include troveclient/compat/tests in testr

All tests should be included in testr.

In test_common.py, the testr command line will be read for parsing,
finally emit error message:
run.py: error: no such option: -t

we should mock the sys.argv in setUp().

The analysis is here
--------------------
troveclient/compat/common.py: CommandsBase
254     def _parse_options(self, parser):
255         opts, args = parser.parse_args()  <-- 1. no arg is passed

/usr/lib/python2.7/optparse.py
1361     def _get_args(self, args):
1362         if args is None:
1363             return sys.argv[1:]  <-- 3. cmdline(testr command) is read
1364         else:
1365             return args[:]

1367     def parse_args(self, args=None, values=None):
...
1381         rargs = self._get_args(args) <-- 2. args is None

Close-Bug #1241845

Change-Id: I092db96d1b6bb31c41e6ba4c5fc9606e3f8ac087
Resolve compatability for troveclient/compat

transform print statement to print function
import urlutils from openstack common

Partial implements: blueprint py33-support

Change-Id: I2491fb6719b21195abb6ea5602ddb8c86487d100
Use six.iteritems() in for loop

Use six.iteritems() in for loop.
Use next() built-in function to return next item.

Partial implements: blueprint py33-support

Change-Id: Idff28608232ad9a41dc63d397d88e363ffde8193
Merge "Fix unicode issue"
Merge "Import exceptions module from openstack-common"
Merge "Import urlutils module from openstack-common"
Merge "Replace urllib.quote with urlutils.quote"
Merge "Import exceptions module from openstack-common"
Merge "Replace g.next() with next(g)"