Refactored existing code and added support for symmetric encryption.

Doc string should be enclosed in `"""` according to [PIP-257](http://legacy.python.org/dev/peps/pep-0257/):
> For consistency, always use """triple double quotes""" around docstrings. Use r"""raw triple double quotes""" if you use any backslashes in your docstrings. For Unicode docstrings, use u"""Unicode triple-quoted strings"""