def __separate_scalar_factor(monomial):
scalar_factor = <NUM_LIT:1><EOL>if is_number_type(monomial):<EOL><INDENT>return S.One, monomial<EOL><DEDENT>if monomial == <NUM_LIT:0>:<EOL><INDENT>return S.One, <NUM_LIT:0><EOL><DEDENT>comm_factors, _ = split_commutative_parts(monomial)<EOL>if len(comm_factors) > <NUM_LIT:0>:<EOL><INDENT>if isinstance(comm_factors[<NUM_LIT:0>], Number):<EOL><INDENT>scalar_factor = comm_factors[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>if scalar_factor != <NUM_LIT:1>:<EOL><INDENT>return monomial / scalar_factor, scalar_factor<EOL><DEDENT>else:<EOL><INDENT>return monomial, scalar_factor<EOL><DEDENT>
Separate the constant factor from a monomial.