def METHOD_NAME(path):
    """
    Given the path (to a (presumably) conda installed file) return the
    environment prefix in which the file in located
    """
    from os.path import abspath, dirname, isdir, join
    prefix = abspath(path)
    iteration = 0
    while iteration < 20:
        if isdir(join(prefix, "conda-meta")):
            # we found it, so let's return it
            break
        if prefix == dirname(prefix):
            # we cannot chop off any more directories, so we didn't find it
            prefix = None
            break
        prefix = dirname(prefix)
        iteration += 1
    return prefix