Fix indentation errors found by Pep8 1.4.6+

As a preparation in order to switch to a newer
Pep8 version in the future, fix the indentation errors
that are missed by Pep8 1.4.5 due to bugs.

Change-Id: I44d1a5194633d2992215fd0d1b740dfd0863e6f1
Closes-Bug: #1267994
Refactor _create_template to not rely on instances

The core of the _create_template logic in autoscaling.py is now in
a separate static method, _resource_templates. _resource_templates is
destined to be moved to another scaling module that is intended to
be used outside of the heat engine, so it won't have access to instance
objects.

Implements: partial blueprint as-lib

Change-Id: I0eda024c88534207daa71de2a8eb53738cdd89ef
Move resource_templates to heat.scaling

This introduces a new package for autoscaling code which is
intended for use outside of the Heat engine, and moves the
resource_templates function into a new module, heat.scaling.template.
The function hasn't been changed at all.

Change-Id: I78c420e7a188f2d14780a03b3ea220b9a5fbe86c
Implements: partial blueprint as-lib
Don't raise MySQL 2013 'Lost connection' errors

cherry pick, including original commit message below from
oslo-incubator commit:

b4f72b2987d53bb434e3a833f06d70a2167f5efc

Closes bug: 1275838

Although this code error is part of the `ping_listener` tests, it was
missing from the list of known - and ignored - connection errors.

The code error 2013 refers to a connection lost during a query, see:
https://dev.mysql.com/doc/refman/5.0/en/error-messages-client.html#error_cr_server_lost

Without this error code, the session won't try to reconnect to mysql,
which makes `max_retries` useless.

Change-Id: Id8a1c0665468b503b092c4f01ffd40e2be9c6fa9
Merge "Refactor _create_template to not rely on instances"
Merge "Move resource_templates to heat.scaling"
Merge "Fix indentation errors found by Pep8 1.4.6+"
Merge "Don't raise MySQL 2013 'Lost connection' errors"