<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sort_key(val):
 """Sort key for sorting keys in grevlex order."""

    return numpy.sum((max(val)+1)**numpy.arange(len(val)-1, -1, -1)*val)