def METHOD_NAME(bitstring, kind):
    with pytest.raises(TypeError):
        test = hamming_weight("0101", return_indexes="True")
    bitstring = f"{bitstring:b}"
    weight_test = len(bitstring.replace("0", ""))
    indexes_test = [item.start() for item in finditer("1", bitstring)]
    weight = hamming_weight(kind(bitstring), False)
    indexes = hamming_weight(kind(bitstring), True)
    assert weight == weight_test
    assert indexes == indexes_test