Take "async" into account when splitting before first arg.

Closes #458
diff --git a/CHANGELOG b/CHANGELOG
index 1adc2b4..c266a36 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,8 @@
 - A non-multiline string may have newlines if it contains continuation markers
   itself. Don't add a newline after the string when retaining the vertical
   space.
+- Take into account the "async" keyword when determining if we must split
+  before the first argument.
 
 ## [0.18.0] 2017-09-18
 ### Added
diff --git a/yapf/yapflib/format_decision_state.py b/yapf/yapflib/format_decision_state.py
index feaffc6..109b64e 100644
--- a/yapf/yapflib/format_decision_state.py
+++ b/yapf/yapflib/format_decision_state.py
@@ -180,8 +180,8 @@
     # Prevent splitting before the first argument in compound statements
     # with the exception of function declarations.
     if (style.Get('SPLIT_BEFORE_FIRST_ARGUMENT') and
-        self.line.first.value != 'def' and
-        _IsCompoundStatement(self.line.first)):
+        _IsCompoundStatement(self.line.first) and
+        not _IsFunctionDef(self.line.first)):
       return False
 
     ###########################################################################
@@ -722,6 +722,12 @@
   return token.value in _COMPOUND_STMTS
 
 
+def _IsFunctionDef(token):
+  if token.value == 'async':
+    token = token.next_token
+  return token.value == 'def'
+
+
 def _IsFunctionCallWithArguments(token):
   while token:
     if token.value == '(':
diff --git a/yapftests/reformatter_python3_test.py b/yapftests/reformatter_python3_test.py
index d353018..bd0c211 100644
--- a/yapftests/reformatter_python3_test.py
+++ b/yapftests/reformatter_python3_test.py
@@ -245,6 +245,73 @@
     uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code)
     self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines))
 
+  def testNoSpacesAroundPowerOparator(self):
+    if sys.version_info[1] < 5:
+      return
+    try:
+      style.SetGlobalStyle(
+          style.CreateStyleFromConfig(
+              '{based_on_style: pep8, '
+              'dedent_closing_brackets: true, '
+              'coalesce_brackets: false, '
+              'space_between_ending_comma_and_closing_bracket: false, '
+              'split_arguments_when_comma_terminated: true, '
+              'split_before_first_argument: true}'))
+      unformatted_code = """\
+async def open_file(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None):
+    pass
+
+async def run_sync_in_worker_thread(sync_fn, *args, cancellable=False, limiter=None):
+    pass
+
+def open_file(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None):
+    pass
+
+def run_sync_in_worker_thread(sync_fn, *args, cancellable=False, limiter=None):
+    pass
+"""
+      expected_formatted_code = """\
+async def open_file(
+        file,
+        mode='r',
+        buffering=-1,
+        encoding=None,
+        errors=None,
+        newline=None,
+        closefd=True,
+        opener=None
+):
+    pass
+
+
+async def run_sync_in_worker_thread(
+        sync_fn, *args, cancellable=False, limiter=None
+):
+    pass
+
+
+def open_file(
+        file,
+        mode='r',
+        buffering=-1,
+        encoding=None,
+        errors=None,
+        newline=None,
+        closefd=True,
+        opener=None
+):
+    pass
+
+
+def run_sync_in_worker_thread(sync_fn, *args, cancellable=False, limiter=None):
+    pass
+"""
+      uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code)
+      self.assertCodeEqual(expected_formatted_code,
+                           reformatter.Reformat(uwlines))
+    finally:
+      style.SetGlobalStyle(style.CreatePEP8Style())
+
 
 if __name__ == '__main__':
   unittest.main()