def filter_request_parameters(field_name, msg, look_in_response=False):
    """
    From an event, extract the field name from the message.
    Different API calls put this information in different places, so check a few places.
    """
    val = msg['detail'].get(field_name, None)
    try:
        if not val:
            val = msg['detail'].get('requestParameters', {}).get(field_name,
                None)
        if not val and look_in_response:
            if msg['detail'].get('responseElements'):
                val = msg['detail']['responseElements'].get(field_name, None)
    except AttributeError:
        val = None
    return val
