<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pop_value(instance, path, ref=None):
 """ Pop the value from `instance` at the given `path`. Parameters instance : dict or list instance from which to retrieve a value path : str path to retrieve a value from ref : str or None reference path if `path` is relative Returns ------- value : value at `path` in `instance` """

    head, tail = os.path.split(abspath(path, ref))
    instance = get_value(instance, head)
    if isinstance(instance, list):
        tail = int(tail)
    return instance.pop(tail)