title: Python - How to generate long, fixed length, valid byte strings?
body: <p>I'm trying to create a socket-based client which can send simulated Call Records to a receiver.
  The socket client is complete, now I need to work on the payload generator.
  The call record looks like this:</p>
  
  <pre><code>CDR = b'173600009                   3052      334088888                   1001   0    #500 0         00000000 0          0    \r\n\x00\x00\x00'
  </code></pre>
  
  <p>Each space is counted, meaning that each bit in this string belongs to a "field"
  Spaces just mean no data for that particular field.</p>
  
  <p>I'm looking for a proper way to generate records like this, but make it simple enough where I can specify a range of values for each field.</p>
  
  <p>Basically:</p>
  
  <pre><code>timestamp = CDR[0:4]
  call_party = CDR[12:18]
  </code></pre>
  
  <p>... etc</p>
  
  <p>then something like</p>
  
  <pre><code>for i in [list_of_call_party]:
    call_party = i
  </code></pre>
  
  <p>finally:</p>
  
  <pre><code>join( timestamp, call_party, etc), etc to create a new VALID record of the proper length.
  </code></pre>
  
  <p>I just need a nudge in the right direction to make this Call record generator.</p>
  
  <p>Thanks!</p>