'Build a 400 error response from the given ValidationError'

def make_validation_error_response(self, validation_error):

    if hasattr(validation_error, 'message_dict'):
        response_obj = {}
        message_dict = dict(validation_error.message_dict)
        non_field_error_list = (message_dict.pop(NON_FIELD_ERRORS, []) + message_dict.pop('non_field_errors', []))
        if non_field_error_list:
            response_obj['developer_message'] = non_field_error_list[0]
        if message_dict:
            response_obj['field_errors'] = {field: {'developer_message': message_dict[field][0]} for field in message_dict}
        return Response(response_obj, status=400)
    else:
        return self.make_error_response(400, validation_error.messages[0])
