def recent_date(**kwargs):
    """Select a recent date range for a location selector.

    :keyword resolution: One keyword time resolution specifier, e.g. ``hours``
        or ``days``.
    :type resolution: int

    >>> recent_date(months=6)
    {'recent': {'months': 6}}
    >>> recent_date(weeks=3)
    {'recent': {'weeks': 3}}
    """
    if not len(kwargs) == 1:
        raise ValueError('Must specify a single date resolution')
    resolution = list(kwargs.keys())[0]
    value = list(kwargs.values())[0]
    if resolution not in 'minuteshoursdaysweeksmonthsyears':
        raise ValueError('Invalid date resolution: %s' % resolution)
    payload = {'recent': {resolution: value}}
    return payload
