plankton: Fix handling of HTTP headers

Handle properly all the image parameters that are requested/returned as HTTP
headers. All parameters must be 'utf-8' encoded. Also, user provided
values like the image name and image properties must also be properly
quoted. Finally, all image properties(HTTP header keys) are lowered and
all punctuation characters are replaced with underscore.

Finally, add section in the image API guide, explaining the required
format for the image metadata.
snf_django: Add utils function to handle unicodes

Add utils functions to handle unicode objects from 'snf-manage' using
the user's preferred encoding. Also add a 'safe_string' function to
escape control characters from strings and unicode objects.
snf_django: Handle unicodes in SynnefoCommand

Extend the SynnefoCommand to override the 'run_from_argv' function in
order to decode command line arguments and options, using the user's
preferred encoding.

Some options of snf-manage commands maybe list or tuples. Applying
'smart_unicode' to them will convert them to unicode object. Instead
of recursively converting data, we convert the arguments to unicodes
before being parsed.
plankton: Handle a potential 500 error in plankton

* Catch a potential 500 error, when registering a file as an Image, while
trying to decode "Image name" into unicode.
* Add corresponding test case
webproject: Wrap stderr in an EncodedStream object

'snf-manage' command wraps the 'stdout' in an EncodedStream objects,
which encodes all unicode objects to bytestrings using the user's
preferred encoding. This commit wraps 'stderr' as well.
astakos: Remove unused lazy_string
astakos: Replace str with unicode

Define __unicode__ in astakos models rather than __str__.
astakos: Use SynnefoCommand to handle unicode

Replace BaseCommand with SynnefoCommand in mngt commands. The latter
properly handles unicode strings.
astakos: Include unicode strings in tests
astakos: Use pprint_table for expired projects
snf_django: Fix csv unicode writer

Use recipe from http://docs.python.org/2/library/csv.html to write unicode
in csv format.
snf_django: Handle unicode in CommandError

Define a custom CommandError, which applies smart_locale_str() in its
__str__ method.
astakos: Use custom CommandError in mngt commands
cyclades: Replace str with smart_unicode
astakos: Use common JSON util in API

Use the 'get_json_body' function, which takes care of encoding errors.
Also, check that the POST body is a dictionary, where needed.