def midpoint(a, b):
    """
    Calculate midpoint between two points.

    Works in any number of dimensions.

    ARGUMENTS: a, b - two points to find mindpoint between.
    """
    middle = []
    for i in range(len(a)):
        middle.append((a[i]+b[i])/2)
    return tuple(middle)