<!--- Verify first that your issue is not already reported on GitHub -->
<!--- Also test if the latest release and devel branch are affected too -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
<!--- Explain the problem briefly below -->
`unique` filter does not respect the order and gives non-idempotent results

##### ISSUE TYPE
- Bug Report


##### COMPONENT NAME
lib/ansible/plugins/filter/mathstuff.py


##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible 2.8.5
```

##### STEPS TO REPRODUCE
<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->
I have the following statement in my template 

```jinja2
{% for host in url_list | map('urlsplit', 'hostname') | unique %}
    upstream {{ host }} {
        server {{ host }}:443;
        keepalive 20;
        keepalive_requests 500;
        keepalive_timeout 30s;
    }
{% endfor %}
```

which basically extracts unique host names from some url list and declares upstream server for each. 

##### EXPECTED RESULTS
The order of hosts is at least consistent between runs. 


##### ACTUAL RESULTS
The order of hosts is different for each run. Unexpected handlers are triggered.

''' Return a human readable string '''
    try:
        return formatters.bytes_to_human(size, isbits, unit)
    except TypeError as e:
        raise AnsibleFilterTypeError("human_readable() failed on bad input: %s" % to_native(e))
    except Exception:
        raise AnsibleFilterError("human_readable() can't interpret following string: %s" % size)
def human_to_bytes(size, default_unit=None, isbits=False):
    ''' Return bytes count from a human readable string '''
    try:
        return formatters.human_to_bytes(size, default_unit, isbits)
    except TypeError as e:
        raise AnsibleFilterTypeError("human_to_bytes() failed on bad input: %s" % to_native(e))
    except Exception:
        raise AnsibleFilterError("human_to_bytes() can't interpret following string: %s" % size)
def rekey_on_member(data, key, duplicates='error'):
    """
    Rekey a dict of dicts on another member
    May also create a dict from a list of dicts.
    duplicates can be one of ``error`` or ``overwrite`` to specify whether to error out if the key
    value would be duplicated or to overwrite previous entries if that's the case.
    """
    if duplicates not in ('error', 'overwrite'):