def __new__(mcs, name, bases, attrs):
    """
        Validate state transition definition
        """
    if bases != (object,):
        if 'from_state' in attrs and 'from_states' in attrs:
            raise Exception('Please use either from_state or from_states')
        if 'from_state' in attrs:
            attrs['from_states'] = attrs['from_state'],
            del attrs['from_state']
        if 'from_states' not in attrs:
            raise Exception('Please give a from_state to this state transition'
                )
        if 'to_state' not in attrs:
            raise Exception('Please give a from_state to this state transition'
                )
        if 'description' not in attrs:
            raise Exception(
                'Please give a description to this state transition')
    if 'handler' in attrs and len(attrs['handler'].__code__.co_varnames) < 3:
        raise Exception(
            'StateTransition handler needs at least three arguments')
    for m in ('has_permission', 'handler', 'validate'):
        if m in attrs:
            attrs[m] = classmethod(attrs[m])
    return type.__new__(mcs, name, bases, attrs)
