def int_to_bin_string(x, bits_for_element):
    """
    Convert an integer to a binary string and put initial padding
      to make it long bits_for_element
        x: integer
        bit_for_element: bit length of machine words
    Returns:
        string
    """
    encoded_text = "{0:b}".format(x)
    len_bin = len(encoded_text)
    if len_bin < bits_for_element: #aggiungo gli 0 iniziali che perdo trasformando in int
        encoded_text = "0"*(bits_for_element-len_bin)+encoded_text
    return encoded_text