<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def external2internal(xe, bounds):
 """ Convert a series of external variables to internal variables"""


    xi = np.empty_like(xe)

    for i, (v, bound) in enumerate(zip(xe, bounds)):

        a = bound[0]  # minimum
        b = bound[1]  # maximum

        if a == None and b == None:  # No constraints
            xi[i] = v

        elif b == None:  # only min
            xi[i] = np.sqrt((v - a + 1.) ** 2. - 1)

        elif a == None:  # only max
            xi[i] = np.sqrt((b - v + 1.) ** 2. - 1)

        else:  # both min and max
            xi[i] = np.arcsin((2. * (v - a) / (b - a)) - 1.)

    return xi