def check_us_buffer(usbuffer):
    """
    Checks that all ultrasound buffer contains all required key values.

    :param usbuffer: the buffer to check
    :raises: KeyError
    :raises: ValueError
    """
    if 'name' not in usbuffer:
        raise KeyError('Buffer configuration must contain a name.')
    if 'start frame' not in usbuffer:
        raise KeyError('Buffer configuration must contain a start frame.')
    if 'end frame' not in usbuffer:
        raise KeyError('Buffer configuration must contain an end frame.')
    if 'x0' not in usbuffer:
        raise KeyError('Buffer configuration must contain x0')
    if 'x1' not in usbuffer:
        raise KeyError('Buffer configuration must contain x1')
    if 'y0' not in usbuffer:
        raise KeyError('Buffer configuration must contain y0')
    if 'y1' not in usbuffer:
        raise KeyError('Buffer configuration must contain y1')
    if 'scan direction' not in usbuffer:
        raise KeyError('Buffer configuration must contain a scan direction.')
    direction = usbuffer.get('scan direction')
    if direction not in ('x', 'y'):
        raise ValueError('scan direction must be either x or y')
