We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Fix `cirq.control` documentation talking about `__control__` instead of `controlled_by`


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cirq/protocols/control.py`
Content:
```
1 # Copyright 2018 The Cirq Developers
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     https://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 from typing import Any, TYPE_CHECKING, TypeVar, Union, Sequence
16 
17 import collections
18 
19 from cirq.ops import op_tree
20 
21 if TYPE_CHECKING:
22     # pylint: disable=unused-import
23     import cirq
24 
25 # This is a special indicator value used by the control method to determine
26 # whether or not the caller provided a 'default' argument.
27 RaiseTypeErrorIfNotProvided = ([],)  # type: Any
28 
29 
30 TDefault = TypeVar('TDefault')
31 
32 def control(controllee: Union['cirq.Gate', op_tree.OP_TREE],
33             control_qubits: Sequence['cirq.Qid'] = None,
34             default: Any = RaiseTypeErrorIfNotProvided) -> Any:
35     """Returns a Controlled version of the given value, if defined.
36 
37     Controllees define how to be controlled by defining a method
38     __control__(self, control_qubits). Note that the method may return
39     NotImplemented to indicate a particular controlling can't be done.
40 
41     Args:
42         controllee: The gate, operation or iterable of operations to control.
43         control_qubits: A list of Qids that would control this controllee.
44         default: Determines the fallback behavior when `controllee` doesn't
45             have a controlling defined. If `default` is not set and the
46             fallback occurs, a TypeError is raised instead.
47 
48     Returns:
49         If `controllee` has a __control__ method that returns something besides
50         NotImplemented, that result is returned. For an OP_TREE, transformation
51         is applied at the leaf. Otherwise, if a default value was specified,
52         the default value is returned.
53 
54     Raises:
55         TypeError: `controllee` doesn't have a __control__ method (or that
56             method returned NotImplemented) and no `default` was specified.
57     """
58     if control_qubits is None:
59         control_qubits = []
60     controller = getattr(controllee, 'controlled_by', None)
61     result = NotImplemented if controller is None else controller(
62                                                            *control_qubits)
63     if result is not NotImplemented:
64         return result
65 
66     if isinstance(controllee, collections.Iterable):
67         return op_tree.transform_op_tree(controllee, op_transformation=
68                                       lambda op: control(op, control_qubits))
69 
70     if default is not RaiseTypeErrorIfNotProvided:
71         return default
72 
73     if controller is None:
74         raise TypeError("object of type '{}' has no controlled_by "
75                         "method.".format(type(controllee)))
76     raise TypeError("object of type '{}' does have a controlled_by method, "
77                     "but it returned NotImplemented.".format(type(controllee)))
78
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cirq/protocols/control.py b/cirq/protocols/control.py
--- a/cirq/protocols/control.py
+++ b/cirq/protocols/control.py
@@ -35,7 +35,7 @@
     """Returns a Controlled version of the given value, if defined.
 
     Controllees define how to be controlled by defining a method
-    __control__(self, control_qubits). Note that the method may return
+    controlled_by(self, control_qubits). Note that the method may return
     NotImplemented to indicate a particular controlling can't be done.
 
     Args:
@@ -46,13 +46,13 @@
             fallback occurs, a TypeError is raised instead.
 
     Returns:
-        If `controllee` has a __control__ method that returns something besides
-        NotImplemented, that result is returned. For an OP_TREE, transformation
-        is applied at the leaf. Otherwise, if a default value was specified,
-        the default value is returned.
+        If `controllee` has a controlled_by method that returns something
+        besides NotImplemented, that result is returned. For an OP_TREE,
+        transformation is applied at the leaf. Otherwise, if a default value
+        was specified, the default value is returned.
 
     Raises:
-        TypeError: `controllee` doesn't have a __control__ method (or that
+        TypeError: `controllee` doesn't have a controlled_by method (or that
             method returned NotImplemented) and no `default` was specified.
     """
     if control_qubits is None:

{"golden_diff": "diff --git a/cirq/protocols/control.py b/cirq/protocols/control.py\n--- a/cirq/protocols/control.py\n+++ b/cirq/protocols/control.py\n@@ -35,7 +35,7 @@\n     \"\"\"Returns a Controlled version of the given value, if defined.\n \n     Controllees define how to be controlled by defining a method\n-    __control__(self, control_qubits). Note that the method may return\n+    controlled_by(self, control_qubits). Note that the method may return\n     NotImplemented to indicate a particular controlling can't be done.\n \n     Args:\n@@ -46,13 +46,13 @@\n             fallback occurs, a TypeError is raised instead.\n \n     Returns:\n-        If `controllee` has a __control__ method that returns something besides\n-        NotImplemented, that result is returned. For an OP_TREE, transformation\n-        is applied at the leaf. Otherwise, if a default value was specified,\n-        the default value is returned.\n+        If `controllee` has a controlled_by method that returns something\n+        besides NotImplemented, that result is returned. For an OP_TREE,\n+        transformation is applied at the leaf. Otherwise, if a default value\n+        was specified, the default value is returned.\n \n     Raises:\n-        TypeError: `controllee` doesn't have a __control__ method (or that\n+        TypeError: `controllee` doesn't have a controlled_by method (or that\n             method returned NotImplemented) and no `default` was specified.\n     \"\"\"\n     if control_qubits is None:\n", "issue": "Fix `cirq.control` documentation talking about `__control__` instead of `controlled_by`\n\n", "before_files": [{"content": "# Copyright 2018 The Cirq Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom typing import Any, TYPE_CHECKING, TypeVar, Union, Sequence\n\nimport collections\n\nfrom cirq.ops import op_tree\n\nif TYPE_CHECKING:\n    # pylint: disable=unused-import\n    import cirq\n\n# This is a special indicator value used by the control method to determine\n# whether or not the caller provided a 'default' argument.\nRaiseTypeErrorIfNotProvided = ([],)  # type: Any\n\n\nTDefault = TypeVar('TDefault')\n\ndef control(controllee: Union['cirq.Gate', op_tree.OP_TREE],\n            control_qubits: Sequence['cirq.Qid'] = None,\n            default: Any = RaiseTypeErrorIfNotProvided) -> Any:\n    \"\"\"Returns a Controlled version of the given value, if defined.\n\n    Controllees define how to be controlled by defining a method\n    __control__(self, control_qubits). Note that the method may return\n    NotImplemented to indicate a particular controlling can't be done.\n\n    Args:\n        controllee: The gate, operation or iterable of operations to control.\n        control_qubits: A list of Qids that would control this controllee.\n        default: Determines the fallback behavior when `controllee` doesn't\n            have a controlling defined. If `default` is not set and the\n            fallback occurs, a TypeError is raised instead.\n\n    Returns:\n        If `controllee` has a __control__ method that returns something besides\n        NotImplemented, that result is returned. For an OP_TREE, transformation\n        is applied at the leaf. Otherwise, if a default value was specified,\n        the default value is returned.\n\n    Raises:\n        TypeError: `controllee` doesn't have a __control__ method (or that\n            method returned NotImplemented) and no `default` was specified.\n    \"\"\"\n    if control_qubits is None:\n        control_qubits = []\n    controller = getattr(controllee, 'controlled_by', None)\n    result = NotImplemented if controller is None else controller(\n                                                           *control_qubits)\n    if result is not NotImplemented:\n        return result\n\n    if isinstance(controllee, collections.Iterable):\n        return op_tree.transform_op_tree(controllee, op_transformation=\n                                      lambda op: control(op, control_qubits))\n\n    if default is not RaiseTypeErrorIfNotProvided:\n        return default\n\n    if controller is None:\n        raise TypeError(\"object of type '{}' has no controlled_by \"\n                        \"method.\".format(type(controllee)))\n    raise TypeError(\"object of type '{}' does have a controlled_by method, \"\n                    \"but it returned NotImplemented.\".format(type(controllee)))\n", "path": "cirq/protocols/control.py"}], "after_files": [{"content": "# Copyright 2018 The Cirq Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom typing import Any, TYPE_CHECKING, TypeVar, Union, Sequence\n\nimport collections\n\nfrom cirq.ops import op_tree\n\nif TYPE_CHECKING:\n    # pylint: disable=unused-import\n    import cirq\n\n# This is a special indicator value used by the control method to determine\n# whether or not the caller provided a 'default' argument.\nRaiseTypeErrorIfNotProvided = ([],)  # type: Any\n\n\nTDefault = TypeVar('TDefault')\n\ndef control(controllee: Union['cirq.Gate', op_tree.OP_TREE],\n            control_qubits: Sequence['cirq.Qid'] = None,\n            default: Any = RaiseTypeErrorIfNotProvided) -> Any:\n    \"\"\"Returns a Controlled version of the given value, if defined.\n\n    Controllees define how to be controlled by defining a method\n    controlled_by(self, control_qubits). Note that the method may return\n    NotImplemented to indicate a particular controlling can't be done.\n\n    Args:\n        controllee: The gate, operation or iterable of operations to control.\n        control_qubits: A list of Qids that would control this controllee.\n        default: Determines the fallback behavior when `controllee` doesn't\n            have a controlling defined. If `default` is not set and the\n            fallback occurs, a TypeError is raised instead.\n\n    Returns:\n        If `controllee` has a controlled_by method that returns something\n        besides NotImplemented, that result is returned. For an OP_TREE,\n        transformation is applied at the leaf. Otherwise, if a default value\n        was specified, the default value is returned.\n\n    Raises:\n        TypeError: `controllee` doesn't have a controlled_by method (or that\n            method returned NotImplemented) and no `default` was specified.\n    \"\"\"\n    if control_qubits is None:\n        control_qubits = []\n    controller = getattr(controllee, 'controlled_by', None)\n    result = NotImplemented if controller is None else controller(\n                                                           *control_qubits)\n    if result is not NotImplemented:\n        return result\n\n    if isinstance(controllee, collections.Iterable):\n        return op_tree.transform_op_tree(controllee, op_transformation=\n                                      lambda op: control(op, control_qubits))\n\n    if default is not RaiseTypeErrorIfNotProvided:\n        return default\n\n    if controller is None:\n        raise TypeError(\"object of type '{}' has no controlled_by \"\n                        \"method.\".format(type(controllee)))\n    raise TypeError(\"object of type '{}' does have a controlled_by method, \"\n                    \"but it returned NotImplemented.\".format(type(controllee)))\n", "path": "cirq/protocols/control.py"}]}