def METHOD_NAME(metabase_url, user, password, expire):
    """Gets an API token from Metabase, using your credentials.
    Equivalent to:
    $ curl -X POST \
    $     -H "Content-Type: application/json" \
    $     -d '{"username": "person@metabase.com", "password": "fakepassword"}' \
    $     http://localhost:3000/api/session
    """
    # we cache credentials to reuse them until they expire, because logins are rate-limited for security
    token = lib.cache.get('metabase-token', filename='linuxfabrik-monitoring-plugins-metabase-stats.db')
    if token:
        return (True, token)
    metabase_url += '/api/session'
    header = {
        'Content-Type': 'application/json',
        }
    data = {
        'username': user,
        'password': password,
        }
    success, result = lib.url.fetch_json(metabase_url, header=header, data=data, encoding='serialized-json')
    if not success:
        return (success, result)
    if not result:
        return (False, 'There was no result from {}.'.format(metabase_url))
    if 'id' not in result:
        return (False, 'Something went wrong, maybe wrong username/password.')
    token = result['id']
    lib.cache.set('metabase-token', token, lib.time.now() + expire, filename='linuxfabrik-monitoring-plugins-metabase-stats.db')
    return (True, token)