def from_wei(number: int, unit: str) -> Union[int, decimal.Decimal]:
if unit.lower() not in units:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format("<STR_LIT:/>".join(units.keys()))<EOL>)<EOL><DEDENT>if number == <NUM_LIT:0>:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>if number < MIN_WEI or number > MAX_WEI:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>unit_value = units[unit.lower()]<EOL>with localcontext() as ctx:<EOL><INDENT>ctx.prec = <NUM_LIT><EOL>d_number = decimal.Decimal(value=number, context=ctx)<EOL>result_value = d_number / unit_value<EOL><DEDENT>return result_value<EOL>
Takes a number of wei and converts it to any other ether unit.