prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  AssertionError when obtaining address of library
  ```solidity
  library UnsafeMath {
      function add(uint a, uint b) external returns (uint) {
          return a + b;
      }
  }
  
  contract Test {
      function getUnsafeMathAddr() public view returns (address) {
          return address(UnsafeMath);
      }
  }
  ```
  
  https://solidity.readthedocs.io/en/latest/contracts.html#libraries:~:text=It%20is%20possible%20to%20obtain%20the%20address%20of%20a%20library
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `slither/slithir/operations/type_conversion.py`
  Content:
  ```
  1 from slither.core.solidity_types.type import Type
  2 from slither.slithir.operations.lvalue import OperationWithLValue
  3 from slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue
  4 
  5 
  6 class TypeConversion(OperationWithLValue):
  7 
  8     def __init__(self, result, variable, variable_type):
  9         super().__init__()
  10         assert is_valid_rvalue(variable)
  11         assert is_valid_lvalue(result)
  12         assert isinstance(variable_type, Type)
  13 
  14         self._variable = variable
  15         self._type = variable_type
  16         self._lvalue = result
  17     
  18 
  19     @property
  20     def variable(self):
  21         return self._variable
  22 
  23     @property
  24     def type(self):
  25         return self._type
  26 
  27     @property
  28     def read(self):
  29         return [self.variable]
  30 
  31     def __str__(self):
  32         return str(self.lvalue) +' = CONVERT {} to {}'.format(self.variable, self.type)
  33
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/slither/slithir/operations/type_conversion.py b/slither/slithir/operations/type_conversion.py
  --- a/slither/slithir/operations/type_conversion.py
  +++ b/slither/slithir/operations/type_conversion.py
  @@ -1,3 +1,4 @@
  +from slither.core.declarations import Contract
   from slither.core.solidity_types.type import Type
   from slither.slithir.operations.lvalue import OperationWithLValue
   from slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue
  @@ -7,7 +8,7 @@
   
       def __init__(self, result, variable, variable_type):
           super().__init__()
  -        assert is_valid_rvalue(variable)
  +        assert is_valid_rvalue(variable) or isinstance(variable, Contract)
           assert is_valid_lvalue(result)
           assert isinstance(variable_type, Type)
  
verification_info: {"golden_diff": "diff --git a/slither/slithir/operations/type_conversion.py b/slither/slithir/operations/type_conversion.py\n--- a/slither/slithir/operations/type_conversion.py\n+++ b/slither/slithir/operations/type_conversion.py\n@@ -1,3 +1,4 @@\n+from slither.core.declarations import Contract\n from slither.core.solidity_types.type import Type\n from slither.slithir.operations.lvalue import OperationWithLValue\n from slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue\n@@ -7,7 +8,7 @@\n \n     def __init__(self, result, variable, variable_type):\n         super().__init__()\n-        assert is_valid_rvalue(variable)\n+        assert is_valid_rvalue(variable) or isinstance(variable, Contract)\n         assert is_valid_lvalue(result)\n         assert isinstance(variable_type, Type)\n", "issue": "AssertionError when obtaining address of library\n```solidity\r\nlibrary UnsafeMath {\r\n    function add(uint a, uint b) external returns (uint) {\r\n        return a + b;\r\n    }\r\n}\r\n\r\ncontract Test {\r\n    function getUnsafeMathAddr() public view returns (address) {\r\n        return address(UnsafeMath);\r\n    }\r\n}\r\n```\r\n\r\nhttps://solidity.readthedocs.io/en/latest/contracts.html#libraries:~:text=It%20is%20possible%20to%20obtain%20the%20address%20of%20a%20library\n", "before_files": [{"content": "from slither.core.solidity_types.type import Type\nfrom slither.slithir.operations.lvalue import OperationWithLValue\nfrom slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue\n\n\nclass TypeConversion(OperationWithLValue):\n\n    def __init__(self, result, variable, variable_type):\n        super().__init__()\n        assert is_valid_rvalue(variable)\n        assert is_valid_lvalue(result)\n        assert isinstance(variable_type, Type)\n\n        self._variable = variable\n        self._type = variable_type\n        self._lvalue = result\n    \n\n    @property\n    def variable(self):\n        return self._variable\n\n    @property\n    def type(self):\n        return self._type\n\n    @property\n    def read(self):\n        return [self.variable]\n\n    def __str__(self):\n        return str(self.lvalue) +' = CONVERT {} to {}'.format(self.variable, self.type)\n", "path": "slither/slithir/operations/type_conversion.py"}], "after_files": [{"content": "from slither.core.declarations import Contract\nfrom slither.core.solidity_types.type import Type\nfrom slither.slithir.operations.lvalue import OperationWithLValue\nfrom slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue\n\n\nclass TypeConversion(OperationWithLValue):\n\n    def __init__(self, result, variable, variable_type):\n        super().__init__()\n        assert is_valid_rvalue(variable) or isinstance(variable, Contract)\n        assert is_valid_lvalue(result)\n        assert isinstance(variable_type, Type)\n\n        self._variable = variable\n        self._type = variable_type\n        self._lvalue = result\n    \n\n    @property\n    def variable(self):\n        return self._variable\n\n    @property\n    def type(self):\n        return self._type\n\n    @property\n    def read(self):\n        return [self.variable]\n\n    def __str__(self):\n        return str(self.lvalue) +' = CONVERT {} to {}'.format(self.variable, self.type)\n", "path": "slither/slithir/operations/type_conversion.py"}]}