title: String encoding using Python in order to compress the size to a fixed length
body: <p>We have table say &quot;analysis_data_table&quot; from where I am fetching a column named &quot;tags&quot; where the entries in this column can vary from an empty record to a long string containing either sql queries, http urls etc.</p>
  <p>My purpose is to compress this field before storing it and decompress when I need.</p>
  <p><strong>Note:
  this compressed string still needs to have the storable entries as I have to save this back in some database table column only.</strong></p>
  <p>the compressed string maybe a meaningless series of hafazard strings(preferably fixed length) which can be reconverted into the original string.</p>
  <p>e.g.</p>
  <pre><code>'''
  input_string = &quot;Python is language&quot;
  
  output_string = some_encoding(input_string)
  
  which gives maybe &quot;r%234khsjlfgkjlslll;dl;hghfd76890sjkjl7897&quot; (larger than the i/p string)
  
  also if
  
  input_string = &quot;Prerequisiste to learn data science is having command over atleast one programming language&quot;
  
  output_string = some_encoding(input_string)
  
  which gives maybe &quot;m$264khsjlfgkjlslll;dl;hghfd76890snmjl7895&quot; (larger than the i/p string)
  '''
  </code></pre>
  <p>so we can note the size is same and storable in both the encodings</p>
  <p>Kindly assist in an encoding way to achieve this.</p>