Hide or remove custom post status

I found the solution i was looking for, if anyone in the future has the same question i am posting the answer.

To make a post with lets say “Status1” to show only “Status2” and hides other statuses like “Status3 and Status4” (with css):

 function hidepoststatus() {

$post="Status1";
    global $post;

if ( $post->post_status == 'Status1' ) {

       ?>

<style>

#post_status option[value="Status3"] {
display: none;
}

    #post_status option[value="Status4"] {
display: none;
}

</style>

<?php

  }
}
add_action( 'admin_head', 'hidepoststatus' );

error code: 523