Does Drupal have any complaints about wrapping contributed module hook in a condition, or including it in another custom made function, in a custom module ?

    if ($condition) {

       function mymodule_modulename_alter ($parameters) {
         //altering code here
       }
    
    }

Thanks