def search(seq, val):
    """Search location of key in a sorted list.

    The method searches the location of a value in a list using
    binary searching algorithm. If it does not find the value, it return -1.

    Args:
        seq: A sorted list where to search the value.
        val: A value to search for.

    Returns:
        The location of the value in the sorted list if found.
        Otherwise returns -1.
    """
    lo, hi = 0, len(seq) - 1
    while lo <= hi:
        mid = (lo + hi) // 2
        if val < seq[mid]:
            hi = mid - 1
        elif val > seq[mid]:
            lo = mid + 1
        else:
            return mid
    return -1
