def get_flight_rules(vis: Number, ceiling: Cloud) -> int:
<EOL>if not vis:<EOL><INDENT>return <NUM_LIT:2><EOL><DEDENT>if vis.repr == '<STR_LIT>' or vis.repr.startswith('<STR_LIT>'):<EOL><INDENT>vis = <NUM_LIT:10>  <EOL><DEDENT>elif vis.repr.startswith('<STR_LIT:M>'):<EOL><INDENT>vis = <NUM_LIT:0>  <EOL><DEDENT>elif len(vis.repr) == <NUM_LIT:4>:<EOL><INDENT>vis = vis.value * <NUM_LIT>  <EOL><DEDENT>else:<EOL><INDENT>vis = vis.value  <EOL><DEDENT>cld = ceiling.altitude if ceiling else <NUM_LIT><EOL>if (vis <= <NUM_LIT:5>) or (cld <= <NUM_LIT:30>):  <EOL><INDENT>if (vis < <NUM_LIT:3>) or (cld < <NUM_LIT:10>):  <EOL><INDENT>if (vis < <NUM_LIT:1>) or (cld < <NUM_LIT:5>):  <EOL><INDENT>return <NUM_LIT:3>  <EOL><DEDENT>return <NUM_LIT:2>  <EOL><DEDENT>return <NUM_LIT:1>  <EOL><DEDENT>return <NUM_LIT:0><EOL>
Returns int based on current flight rules from parsed METAR data

0=VFR, 1=MVFR, 2=IFR, 3=LIFR

Note: Common practice is to report IFR if visibility unavailable