def _validate_event(event_key, event_value):
    try:
        event_key = str(event_key)
    except ValueError:
        raise ValueError('Event key should not contain non-ascii characters')

    if not event_key:
        raise ValueError('Event key must be a non-empty string')

    if isinstance(event_value, (str, unicode)):
        try:
            event_value = loads(event_value)
        except ValueError:
            raise ValueError('Event value must be a number or an array of numbers')

    if not isinstance(event_value, list):
        try:
            event_value = float(event_value)
        except (TypeError, __HOLE__):
            raise ValueError('Event value must be a number or an array of numbers')
    else:
        try:
            for index, value in enumerate(event_value):
                event_value[index] = float(value)
        except (TypeError, ValueError):
            raise ValueError('Event value array elements must be numbers')

    return event_key, event_value
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/controllers/apiv1/custommetrics.py/_validate_event