{config, constants, output}.py: Adds notice level

The -q flag setting was being ignored by output.notice() calls.
Adding note_level to the output.notice() function makes it so
that the output will be quieted, if desired.

X-Gentoo-Bug: 457726
X-Gentoo-Bug-URL: https://bugs.gentoo.org/457726
Alters "Exception, error" to "Exception as error"

This changes the all instances of the phrase "Exception, error" to
"Exception as error" to allow py2/py3 compatibility.
overlays/tar.py: Changes permissions integer to octal
dbbase.py: Adds compatibility to exception handling.
Adds unicode string compatibility support

Ensures that the necessary strings that need to be unicode, stay
unicode in both py2 and py3 when running layman.
layman/*.py: converts keys() to lists

For py2/py3 compatibility variables such as self.overlays.keys()
or self.overlays.items() need to be implicitly converted into lists.
layman/{output, version}.py: Updates print() functions
layman/api.py: Corrects output of repos and stderr

Due to repos coming in as a binary string, it needed to be converted
to a normal string before joining it in the debug message or it will
cause runtime failures. Due to 2to3 overlooking the print statement
on line 513, this has also been corrected along with a check to see if
the repos variable is an instance of type str instead of type basestring
which is no longer available in py3.
layman/config.py: Adds py3 compatibility for ConfigParser
dbbase.py: Adds unicode compatibility to ElementTree

When writing the database to installed.xml, ElementTree needs to have
an encoding type specified or run time errors will occur. To ensure
compatibility between py2/py3 a check has been made to see which
python version is running and to set the _unicode variable
accordingly.
layman/makeconf.py: Implements cmp_to_key on prio_sort

To ensure py2/py3 compat, the cmp_to_key function has been used to
the convert the variable prio_sort to a key instead of a comparison
like py3 returns prio_sort to be.
layman/output.py: Adds file output compatibility

In order to allow users to set the output for error and normal
output we need to check to see if users have set the output to be
of type file. In py2 this is specified by the variable "file",
however in py3 this is specified by io.IOBase which encompasses
all file types such as Raw, Text, and Buffered files.
utils.py: Adds str type checking for path_elements
layman/cli.py: Adds byte array support

When checking the selection of which servers to sync/add there is
a check to see if 'ALL' is specified. In py2 with argparser this
works, but with py3 and argparser, this doesn't work because the
'ALL' string will come in as a bytearray. This commit fixes that
by checking the python version and assigning a varaible to be checked
instead of a simple string like 'ALL'. It will now come in as either
'ALL' or b'ALL', py version dependent. A small fix is also made to
docstring to make the print function py3 compatibile.
remotedb.py, tar.py: Implements ssl-fetch code

Migrate to using ssl-fetch (urllib3 based) for downloading files.
dbbase.py: Fixes implicit tuple unpacking

A temporary variable is assigned to fix the lack of implicit tuple
unpacking in py3.
argsparser.py: Migrates from optparse to argparse

Included with this patch is another flag, -C for config dir as well
as default values for configdir, config, and overlay_defs. Also
included is interpolation of these variables, because argparse lacks
the necessary interpolation.
argsparser.py: Alphabetizes group arguments
output.py: Migrates output mappings

remotedb.py, tar.py: Removes output mappings necessary for ssl-fetch
usage in favor of mapping them in output.py to avoid mapping the
functions in more than one place.
layman/*.py: Removes unnecessary lists

To give a minimal increase in performance some lists declarations
have been removed.