<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dihedral(x, dih):
 """ Perform any of 8 permutations of 90-degrees rotations or flips for image x. """

    x = np.rot90(x, dih%4)
    return x if dih<4 else np.fliplr(x)