def Hamming_weight(integer_list):
    """ Computes the Hamming weight of an integer or a list of integers (number
     of bits equal to one).
    """
    if isinstance(integer_list, list):
        weights = [Hamming_weight(k) for k in integer_list]
        return weights
    elif isinstance(integer_list, int):
        w = 0
        n = integer_list
        while n > 0:
            if n % 2:
                w += 1
            n = n // 2
        return w
    else:
        er = "unsupported input type for Hamming_weight:" + str(integer_list)
        raise ValueError(er)