def get(parameters, key, default=None, cast=str):
    """
    Get the given query string parameter.
    """
    try:
        return cast(parameters[key][0]) if key in parameters else default
    except TypeError:
        return default