def Sort_Points(x_values, y_values, error):
    """
    Combine three arrays and sorts by ascending values of the first.

    Args:
        x_values (1darray):
            Array of x-values. This array is the one which sorting will be based.
            Each index of this array is related to the same index value of the other two.
        y_values (1darray):
            Array of y-values. Each index of this array is related to the same index
            value of the other two.
        error (1darray):
            Array of error values. Each index of this array is related to the same
            index value of the other two.
    Returns:
        x_val (1darray):
            x_values array sorted in ascending order.
        y_val (1darray):
            y_values array sorted based on new index order of x_val.
        errors (1darray):
            error array sorted based on new index order of x_val.
    """
    to_return = []
    # If/Else statement to confirm that the arrays are the same length. Print error message if not.
    if len(x_values) == len(y_values) == len(error):

        for j in range(len(x_values)):
            file_point = (((x_values[j])), (y_values[j]), (error[j]))
            to_return.append(file_point)
            to_return.sort()

        x_val = [x[0] for x in to_return]
        y_val = [y[1] for y in to_return]
        errors = [y[2] for y in to_return]
    else:
        print('the given arrays are of different lengths')
        x_val = False
        y_val = False
        errors = False

    return(x_val, y_val, errors)