def get_request_data(form, request):

    """
    Given a form and a request object we pull out
    from the request what the form defines.

    i.e.::

       form = {
            'data1': None
       }

    get_request_data(form, request) will then fill that data with what's in
    the request object.

    :param form: A dictionary of items which should be filled from
    :param request: The request object where the data should be taken from.
    :returns: A dictionary which contains the actual data from the request.
    :rtype: :class:`dict`
    :raises: KeyError
    """

    data = dict()

    # get our form data
    for key in form:
        data[key] = request.POST.get(key, None)

    # get the user id from the session
    data['user_id'] = request.session['user_id']

    return data