def METHOD_NAME(fd, group, bit):
    try:
        bit = int(bit, 0)
        if bit < 0 or bit >= 64:
            raise ValueError
    except ValueError:
        print("'%s' is not a valid bit number in range [0, 64)" % bit)
        sys.exit(1)
    h = QcowHeader(fd)
    if group == 'incompatible':
        h.incompatible_features |= 1 << bit
    elif group == 'compatible':
        h.compatible_features |= 1 << bit
    elif group == 'autoclear':
        h.autoclear_features |= 1 << bit
    else:
        print("'%s' is not a valid group, try "
              "'incompatible', 'compatible', or 'autoclear'" % group)
        sys.exit(1)
    h.update(fd)