<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def gmean(x, weights=None):
 """ Return the weighted geometric mean of x """

    w_arr, x_arr = _preprocess_inputs(x, weights)
    return np.exp((w_arr*np.log(x_arr)).sum(axis=0) / w_arr.sum(axis=0))