code: def create_csr(cls, common_name, private_key=None, params=None):
          
          params = params or []
  
          params = [(key, val) for key, val in params if val]
          subj = '/' + '/'.join(['='.join(value) for value in params])
  
          cmd, private_key = cls.gen_pk(common_name, private_key)
  
          if private_key.endswith('.crt') or private_key.endswith('.key'):
              csr_file = re.sub(r'\.(crt|key)$', '.csr', private_key)
          else:
              csr_file = private_key + '.csr'
  
          cmd = cmd % {'csr': csr_file, 'key': private_key, 'subj': subj}
          result = cls.execute(cmd)
          if not result:
              cls.echo('CSR creation failed')
              cls.echo(cmd)
              return
  
          return csr_file
docs: Create CSR.