We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Cannot convert to address
### Version Information

* vyper Version:  0.2.0b4

### What's your issue about?
Vyper disallows converting to an address. This is a problem because sometimes we need to process stuff from bytes to an address.

#### Cute Animal Picture
![blue donkey](http://bellatravelplanning.com/wp-content/uploads/2017/10/DSC_0251.jpg)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `vyper/types/convert.py`
Content:
```
1 import ast
2 import warnings
3 
4 from vyper.functions.signature import (
5     signature
6 )
7 from vyper.parser.parser_utils import (
8     LLLnode,
9     getpos,
10     byte_array_to_num
11 )
12 from vyper.exceptions import (
13     InvalidLiteralException,
14     TypeMismatchException,
15     ParserException,
16 )
17 from vyper.types import (
18     BaseType,
19 )
20 from vyper.types import (
21     get_type,
22 )
23 from vyper.utils import (
24     DECIMAL_DIVISOR,
25     MemoryPositions,
26     SizeLimits
27 )
28 
29 
30 @signature(('uint256', 'bytes32', 'bytes'), '*')
31 def to_int128(expr, args, kwargs, context):
32     in_node = args[0]
33     typ, len = get_type(in_node)
34     if typ in ('uint256', 'bytes32'):
35         if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):
36             raise InvalidLiteralException("Number out of range: {}".format(in_node.value), expr)
37         return LLLnode.from_list(
38             ['clamp', ['mload', MemoryPositions.MINNUM], in_node,
39                         ['mload', MemoryPositions.MAXNUM]], typ=BaseType('int128', in_node.typ.unit), pos=getpos(expr)
40         )
41     else:
42         return byte_array_to_num(in_node, expr, 'int128')
43 
44 
45 @signature(('num_literal', 'int128', 'bytes32', 'address'), '*')
46 def to_uint256(expr, args, kwargs, context):
47     in_node = args[0]
48     input_type, len = get_type(in_node)
49 
50     if isinstance(in_node, int):
51         if not SizeLimits.in_bounds('uint256', in_node):
52             raise InvalidLiteralException("Number out of range: {}".format(in_node))
53         _unit = in_node.typ.unit if input_type == 'int128' else None
54         return LLLnode.from_list(in_node, typ=BaseType('uint256', _unit), pos=getpos(expr))
55 
56     elif isinstance(in_node, LLLnode) and input_type in ('int128', 'num_literal'):
57         _unit = in_node.typ.unit if input_type == 'int128' else None
58         return LLLnode.from_list(['clampge', in_node, 0], typ=BaseType('uint256', _unit), pos=getpos(expr))
59 
60     elif isinstance(in_node, LLLnode) and input_type in ('bytes32', 'address'):
61         return LLLnode(value=in_node.value, args=in_node.args, typ=BaseType('uint256'), pos=getpos(expr))
62 
63     else:
64         raise InvalidLiteralException("Invalid input for uint256: %r" % in_node, expr)
65 
66 
67 @signature(('int128', 'uint256'), '*')
68 def to_decimal(expr, args, kwargs, context):
69     input = args[0]
70     if input.typ.typ == 'uint256':
71         return LLLnode.from_list(
72             ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],
73             typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)
74         )
75     else:
76         return LLLnode.from_list(
77             ['mul', input, DECIMAL_DIVISOR],
78             typ=BaseType('decimal', input.typ.unit, input.typ.positional),
79             pos=getpos(expr)
80         )
81 
82 
83 @signature(('int128', 'uint256', 'address', 'bytes'), '*')
84 def to_bytes32(expr, args, kwargs, context):
85     in_arg = args[0]
86     typ, _len = get_type(in_arg)
87 
88     if typ == 'bytes':
89 
90         if _len > 32:
91             raise TypeMismatchException("Unable to convert bytes[{}] to bytes32, max length is too large.".format(len))
92 
93         if in_arg.location == "memory":
94             return LLLnode.from_list(
95             ['mload', ['add', in_arg, 32]], typ=BaseType('bytes32')
96             )
97         elif in_arg.location == "storage":
98             return LLLnode.from_list(
99                 ['sload', ['add', ['sha3_32', in_arg], 1]], typ=BaseType('bytes32')
100             )
101 
102     else:
103         return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('bytes32'), pos=getpos(expr))
104 
105 
106 def convert(expr, context):
107 
108     if isinstance(expr.args[1], ast.Str):
109         warnings.warn(
110             "String parameter has been removed, see VIP1026). "
111             "Use a vyper type instead.",
112             DeprecationWarning
113         )
114 
115     if isinstance(expr.args[1], ast.Name):
116         output_type = expr.args[1].id
117     else:
118         raise ParserException("Invalid conversion type, use valid vyper type.", expr)
119 
120     if output_type in conversion_table:
121         return conversion_table[output_type](expr, context)
122     else:
123         raise ParserException("Conversion to {} is invalid.".format(output_type), expr)
124 
125 
126 conversion_table = {
127     'int128': to_int128,
128     'uint256': to_uint256,
129     'decimal': to_decimal,
130     'bytes32': to_bytes32,
131 }
132
```
--- 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/vyper/types/convert.py b/vyper/types/convert.py
--- a/vyper/types/convert.py
+++ b/vyper/types/convert.py
@@ -103,6 +103,13 @@
         return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('bytes32'), pos=getpos(expr))
 
 
+@signature(('bytes32'), '*')
+def to_address(expr, args, kwargs, context):
+    in_arg = args[0]
+
+    return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('address'), pos=getpos(expr))
+
+
 def convert(expr, context):
 
     if isinstance(expr.args[1], ast.Str):
@@ -128,4 +135,5 @@
     'uint256': to_uint256,
     'decimal': to_decimal,
     'bytes32': to_bytes32,
+    'address': to_address,
 }

{"golden_diff": "diff --git a/vyper/types/convert.py b/vyper/types/convert.py\n--- a/vyper/types/convert.py\n+++ b/vyper/types/convert.py\n@@ -103,6 +103,13 @@\n         return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('bytes32'), pos=getpos(expr))\n \n \n+@signature(('bytes32'), '*')\n+def to_address(expr, args, kwargs, context):\n+    in_arg = args[0]\n+\n+    return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('address'), pos=getpos(expr))\n+\n+\n def convert(expr, context):\n \n     if isinstance(expr.args[1], ast.Str):\n@@ -128,4 +135,5 @@\n     'uint256': to_uint256,\n     'decimal': to_decimal,\n     'bytes32': to_bytes32,\n+    'address': to_address,\n }\n", "issue": "Cannot convert to address\n### Version Information\r\n\r\n* vyper Version:  0.2.0b4\r\n\r\n### What's your issue about?\r\nVyper disallows converting to an address. This is a problem because sometimes we need to process stuff from bytes to an address.\r\n\r\n#### Cute Animal Picture\r\n![blue donkey](http://bellatravelplanning.com/wp-content/uploads/2017/10/DSC_0251.jpg)\n", "before_files": [{"content": "import ast\nimport warnings\n\nfrom vyper.functions.signature import (\n    signature\n)\nfrom vyper.parser.parser_utils import (\n    LLLnode,\n    getpos,\n    byte_array_to_num\n)\nfrom vyper.exceptions import (\n    InvalidLiteralException,\n    TypeMismatchException,\n    ParserException,\n)\nfrom vyper.types import (\n    BaseType,\n)\nfrom vyper.types import (\n    get_type,\n)\nfrom vyper.utils import (\n    DECIMAL_DIVISOR,\n    MemoryPositions,\n    SizeLimits\n)\n\n\n@signature(('uint256', 'bytes32', 'bytes'), '*')\ndef to_int128(expr, args, kwargs, context):\n    in_node = args[0]\n    typ, len = get_type(in_node)\n    if typ in ('uint256', 'bytes32'):\n        if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node.value), expr)\n        return LLLnode.from_list(\n            ['clamp', ['mload', MemoryPositions.MINNUM], in_node,\n                        ['mload', MemoryPositions.MAXNUM]], typ=BaseType('int128', in_node.typ.unit), pos=getpos(expr)\n        )\n    else:\n        return byte_array_to_num(in_node, expr, 'int128')\n\n\n@signature(('num_literal', 'int128', 'bytes32', 'address'), '*')\ndef to_uint256(expr, args, kwargs, context):\n    in_node = args[0]\n    input_type, len = get_type(in_node)\n\n    if isinstance(in_node, int):\n        if not SizeLimits.in_bounds('uint256', in_node):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node))\n        _unit = in_node.typ.unit if input_type == 'int128' else None\n        return LLLnode.from_list(in_node, typ=BaseType('uint256', _unit), pos=getpos(expr))\n\n    elif isinstance(in_node, LLLnode) and input_type in ('int128', 'num_literal'):\n        _unit = in_node.typ.unit if input_type == 'int128' else None\n        return LLLnode.from_list(['clampge', in_node, 0], typ=BaseType('uint256', _unit), pos=getpos(expr))\n\n    elif isinstance(in_node, LLLnode) and input_type in ('bytes32', 'address'):\n        return LLLnode(value=in_node.value, args=in_node.args, typ=BaseType('uint256'), pos=getpos(expr))\n\n    else:\n        raise InvalidLiteralException(\"Invalid input for uint256: %r\" % in_node, expr)\n\n\n@signature(('int128', 'uint256'), '*')\ndef to_decimal(expr, args, kwargs, context):\n    input = args[0]\n    if input.typ.typ == 'uint256':\n        return LLLnode.from_list(\n            ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],\n            typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)\n        )\n    else:\n        return LLLnode.from_list(\n            ['mul', input, DECIMAL_DIVISOR],\n            typ=BaseType('decimal', input.typ.unit, input.typ.positional),\n            pos=getpos(expr)\n        )\n\n\n@signature(('int128', 'uint256', 'address', 'bytes'), '*')\ndef to_bytes32(expr, args, kwargs, context):\n    in_arg = args[0]\n    typ, _len = get_type(in_arg)\n\n    if typ == 'bytes':\n\n        if _len > 32:\n            raise TypeMismatchException(\"Unable to convert bytes[{}] to bytes32, max length is too large.\".format(len))\n\n        if in_arg.location == \"memory\":\n            return LLLnode.from_list(\n            ['mload', ['add', in_arg, 32]], typ=BaseType('bytes32')\n            )\n        elif in_arg.location == \"storage\":\n            return LLLnode.from_list(\n                ['sload', ['add', ['sha3_32', in_arg], 1]], typ=BaseType('bytes32')\n            )\n\n    else:\n        return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('bytes32'), pos=getpos(expr))\n\n\ndef convert(expr, context):\n\n    if isinstance(expr.args[1], ast.Str):\n        warnings.warn(\n            \"String parameter has been removed, see VIP1026). \"\n            \"Use a vyper type instead.\",\n            DeprecationWarning\n        )\n\n    if isinstance(expr.args[1], ast.Name):\n        output_type = expr.args[1].id\n    else:\n        raise ParserException(\"Invalid conversion type, use valid vyper type.\", expr)\n\n    if output_type in conversion_table:\n        return conversion_table[output_type](expr, context)\n    else:\n        raise ParserException(\"Conversion to {} is invalid.\".format(output_type), expr)\n\n\nconversion_table = {\n    'int128': to_int128,\n    'uint256': to_uint256,\n    'decimal': to_decimal,\n    'bytes32': to_bytes32,\n}\n", "path": "vyper/types/convert.py"}], "after_files": [{"content": "import ast\nimport warnings\n\nfrom vyper.functions.signature import (\n    signature\n)\nfrom vyper.parser.parser_utils import (\n    LLLnode,\n    getpos,\n    byte_array_to_num\n)\nfrom vyper.exceptions import (\n    InvalidLiteralException,\n    TypeMismatchException,\n    ParserException,\n)\nfrom vyper.types import (\n    BaseType,\n)\nfrom vyper.types import (\n    get_type,\n)\nfrom vyper.utils import (\n    DECIMAL_DIVISOR,\n    MemoryPositions,\n    SizeLimits\n)\n\n\n@signature(('uint256', 'bytes32', 'bytes'), '*')\ndef to_int128(expr, args, kwargs, context):\n    in_node = args[0]\n    typ, len = get_type(in_node)\n    if typ in ('uint256', 'bytes32'):\n        if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node.value), expr)\n        return LLLnode.from_list(\n            ['clamp', ['mload', MemoryPositions.MINNUM], in_node,\n                        ['mload', MemoryPositions.MAXNUM]], typ=BaseType('int128', in_node.typ.unit), pos=getpos(expr)\n        )\n    else:\n        return byte_array_to_num(in_node, expr, 'int128')\n\n\n@signature(('num_literal', 'int128', 'bytes32', 'address'), '*')\ndef to_uint256(expr, args, kwargs, context):\n    in_node = args[0]\n    input_type, len = get_type(in_node)\n\n    if isinstance(in_node, int):\n        if not SizeLimits.in_bounds('uint256', in_node):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node))\n        _unit = in_node.typ.unit if input_type == 'int128' else None\n        return LLLnode.from_list(in_node, typ=BaseType('uint256', _unit), pos=getpos(expr))\n\n    elif isinstance(in_node, LLLnode) and input_type in ('int128', 'num_literal'):\n        _unit = in_node.typ.unit if input_type == 'int128' else None\n        return LLLnode.from_list(['clampge', in_node, 0], typ=BaseType('uint256', _unit), pos=getpos(expr))\n\n    elif isinstance(in_node, LLLnode) and input_type in ('bytes32', 'address'):\n        return LLLnode(value=in_node.value, args=in_node.args, typ=BaseType('uint256'), pos=getpos(expr))\n\n    else:\n        raise InvalidLiteralException(\"Invalid input for uint256: %r\" % in_node, expr)\n\n\n@signature(('int128', 'uint256'), '*')\ndef to_decimal(expr, args, kwargs, context):\n    input = args[0]\n    if input.typ.typ == 'uint256':\n        return LLLnode.from_list(\n            ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],\n            typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)\n        )\n    else:\n        return LLLnode.from_list(\n            ['mul', input, DECIMAL_DIVISOR],\n            typ=BaseType('decimal', input.typ.unit, input.typ.positional),\n            pos=getpos(expr)\n        )\n\n\n@signature(('int128', 'uint256', 'address', 'bytes'), '*')\ndef to_bytes32(expr, args, kwargs, context):\n    in_arg = args[0]\n    typ, _len = get_type(in_arg)\n\n    if typ == 'bytes':\n\n        if _len > 32:\n            raise TypeMismatchException(\"Unable to convert bytes[{}] to bytes32, max length is too large.\".format(len))\n\n        if in_arg.location == \"memory\":\n            return LLLnode.from_list(\n            ['mload', ['add', in_arg, 32]], typ=BaseType('bytes32')\n            )\n        elif in_arg.location == \"storage\":\n            return LLLnode.from_list(\n                ['sload', ['add', ['sha3_32', in_arg], 1]], typ=BaseType('bytes32')\n            )\n\n    else:\n        return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('bytes32'), pos=getpos(expr))\n\n\n@signature(('bytes32'), '*')\ndef to_address(expr, args, kwargs, context):\n    in_arg = args[0]\n\n    return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('address'), pos=getpos(expr))\n\n\ndef convert(expr, context):\n\n    if isinstance(expr.args[1], ast.Str):\n        warnings.warn(\n            \"String parameter has been removed, see VIP1026). \"\n            \"Use a vyper type instead.\",\n            DeprecationWarning\n        )\n\n    if isinstance(expr.args[1], ast.Name):\n        output_type = expr.args[1].id\n    else:\n        raise ParserException(\"Invalid conversion type, use valid vyper type.\", expr)\n\n    if output_type in conversion_table:\n        return conversion_table[output_type](expr, context)\n    else:\n        raise ParserException(\"Conversion to {} is invalid.\".format(output_type), expr)\n\n\nconversion_table = {\n    'int128': to_int128,\n    'uint256': to_uint256,\n    'decimal': to_decimal,\n    'bytes32': to_bytes32,\n    'address': to_address,\n}\n", "path": "vyper/types/convert.py"}]}