<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def num(value):
 """Convert a value from one of several bases to an int."""

    if re_hex_num.match(value):
        return int(value, base=16)
    else:
        return int(value)