title: How to replace a individual bit within a python opbject of types bytes by setting its value explicitely
body: <p>Let's assume I have a variable tmp that is of type bytes and contains zeros and ones. I want to replace the value of the fifth position within tmp by setting an explicit value (e.g. 1).</p>
  
  <p>I wonder what is a clean way to replace individual bits within an object (tmp) that has type 'Bytes'. I would like to set it directly. My attempt does not work. Help in understanding the problem in my approach would highly be appreciated.</p>
  
  <pre><code>print(tmp)       # -&gt; b'00101001'
  print(type(tmp)) # -&gt; &lt;class 'bytes'&gt;
  tmp[3] =  1      # Expected b'00111001' but actually got TypeError: 'bytes' object does not support item assignment
  </code></pre>
  
  <p>Is there a function like set_bit_in(tmp, position, bit_value)?</p>