def location_validator(archive=None):
    def validator(text):
        try:
            loc = Location(text)
        except __HOLE__:
            raise argparse.ArgumentTypeError('Invalid location format: "%s"' % text)
        if archive is True and not loc.archive:
            raise argparse.ArgumentTypeError('"%s": No archive specified' % text)
        elif archive is False and loc.archive:
            raise argparse.ArgumentTypeError('"%s" No archive can be specified' % text)
        return loc
    return validator
dataset/ETHPy150Open jborg/attic/attic/helpers.py/location_validator