def _border_type(i, values):
    """
    Returns border type:

    :param i: index of potential border
    :param values: insulation index values
    :return: if border: 1 or -1, else 0. 1 if derivative at border is >0, -1 otherwise
    """
    if i == 0:
        return 1
    if i == len(values) - 1:
        return -1
    if values[i - 1] <= 0 <= values[i + 1]:
        return 1
    if values[i + 1] <= 0 <= values[i - 1]:
        return -1
    return 0
