'Ensure that types used in cdef functions are public or api, or
defined in a C header.'

def _validate_type_visibility(self, type, pos, env):

    public_or_api = ((self.visibility == 'public') or self.api)
    entry = getattr(type, 'entry', None)
    if (public_or_api and entry and env.is_module_scope):
        if (not ((entry.visibility in ('public', 'extern')) or entry.api or entry.in_cinclude)):
            error(pos, 'Function    declared    public    or    api    may    not    have    private    types')
