chore: blacken (#206)

Also, fix 2.7 tests broken by release of 'googleapis-common-protos 1.53.0',
which dropped Python 2.7 support.

Closes #169
diff --git a/noxfile.py b/noxfile.py
index 650cef2..10a92ef 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -20,10 +20,18 @@
 # https://github.com/google/importlab/issues/25
 import nox  # pytype: disable=import-error
 
+
+BLACK_VERSION = "black==19.10b0"
+BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
+# Black and flake8 clash on the syntax for ignoring flake8's F401 in this file.
+BLACK_EXCLUDES = ["--exclude", "^/google/api_core/operations_v1/__init__.py"]
+
+DEFAULT_PYTHON_VERSION = "3.7"
 CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
 
 _MINIMAL_ASYNCIO_SUPPORT_PYTHON_VERSION = [3, 6]
 
+
 def _greater_or_equal_than_36(version_string):
     tokens = version_string.split(".")
     for i, token in enumerate(tokens):
@@ -34,6 +42,31 @@
     return tokens >= [3, 6]
 
 
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def lint(session):
+    """Run linters.
+
+    Returns a failure if the linters find linting errors or sufficiently
+    serious code quality issues.
+    """
+    session.install("flake8", "flake8-import-order", BLACK_VERSION)
+    session.install(".")
+    session.run(
+        "black", "--check", *BLACK_EXCLUDES, *BLACK_PATHS,
+    )
+    session.run("flake8", "google", "tests")
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def blacken(session):
+    """Run black.
+
+    Format code to uniform standard.
+    """
+    session.install(BLACK_VERSION)
+    session.run("black", *BLACK_EXCLUDES, *BLACK_PATHS)
+
+
 def default(session):
     """Default unit test session.
 
@@ -96,18 +129,6 @@
 
 
 @nox.session(python="3.6")
-def lint(session):
-    """Run linters.
-
-    Returns a failure if the linters find linting errors or sufficiently
-    serious code quality issues.
-    """
-    session.install("flake8", "flake8-import-order")
-    session.install(".")
-    session.run("flake8", "google", "tests")
-
-
-@nox.session(python="3.6")
 def lint_setup_py(session):
     """Verify that setup.py is valid (including RST check)."""