Implement an RPC server with the following functionalities in the file /app/rpc_server.py. The server must support the following methods:
echo(message: string) -> string
Returns the message it receives as input.
add(a: int, b: int) -> int
Returns the sum of the two integers provided as input.
sub(a: int, b: int) -> int
Returns the result of subtracting b from a.
mul(a: int, b: int) -> int
Returns the product of the two integers provided as input.
div(a: float, b: float) -> float
Returns the result of dividing a by b. Ensure to handle division by zero by returning an appropriate error message.
enum_echo(phone_type: PhoneType) -> int
Accepts an enum value representing a phone type and returns the corresponding integer value.
hash_echo(address: Address) -> hash
Accepts a hash object representing an address and returns it unchanged.
notify(value: string) -> bool
Simply prints the provided value on the server side and returns True.
is_authenticated() -> bool
Returns the authentication status, which can be a static True for simplicity.
get_username() -> string
Returns the username of the logged-in user as a static string for testing purposes.
In addition, the server should implement the following service descriptions:
Implement __describe_service to return service metadata including version, name, and description.
Implement __describe_functions to return the list of function descriptions as specified in the test code.
Implement __describe_custom_types to return the list of custom types (PhoneType and Address) as described in the test code.
The output should be in JSON format, and the server should listen on localhost at port 5500. Utilize a suitable RPC framework to facilitate the implementation.