def query2str(items, max_length=1024):

    return '\n'.join(['%s=%s' % (k, v) for k, v in six.iteritems(items)
                      if k != PASSWORD_FORM_FIELD][:int(max_length/2)])[:max_length]
Turns a dictionary into an easy-to-read list of key-value pairs.
dataset/ETHPy150Open django-pci/django-axes/axes/decorators.py/query2str