def getlocation(function, curdir=None):
    function = get_real_func(function)
    fn = py.path.local(inspect.getfile(function))
    lineno = function.__code__.co_firstlineno
    if ((curdir is not None) and fn.relto(curdir)):
        fn = fn.relto(curdir)
    return ('%s:%d' % (fn, (lineno + 1)))
def getlocation(function, curdir=None):
    function = get_real_func(function)
    fn = py.path.local(inspect.getfile(function))
    lineno = function.__code__.co_firstlineno
    if ((curdir is not None) and fn.relto(curdir)):
        fn = fn.relto(curdir)
    return ('%s:%d' % (fn, (lineno + 1)))