import glob


def first_glob(glob_pat):
    """Returns the first match for the passed glob_pat, or raises error."""
    maybe = glob.glob(glob_pat)
    if len(maybe) == 0:
        raise LookupError("No %s" % glob_pat)
    if len(maybe) == 1:
        return maybe[0].replace("\\", "/")
    raise LookupError("Too many %s: %s" % (glob_pat, maybe))