class RegistryUtils {
    public static DefaultListableBeanFactory maybeRegistryToBeanFactory(BeanDefinitionRegistry registry) {<FILL_FUNCTION_BODY>}
}

        if (registry instanceof DefaultListableBeanFactory) {
            return (DefaultListableBeanFactory) registry;
        } else if (registry instanceof GenericApplicationContext) {
            return ((GenericApplicationContext) registry).getDefaultListableBeanFactory();
        }
        return null;
    
<no_super_class>