def _Bound_Ps(P, s):
    """Region definition for input P and s

    Parameters
    ----------
    P : float
        Pressure, [MPa]
    s : float
        Specific entropy, [kJ/kgK]

    Returns
    -------
    region : float
        IAPWS-97 region code

    References
    ----------
    Wagner, W; Kretzschmar, H-J: International Steam Tables: Properties of
    Water and Steam Based on the Industrial Formulation IAPWS-IF97; Springer,
    2008; doi: 10.1007/978-3-540-74234-0. Fig. 2.9
    """
    region = None
    if Pmin <= P <= Ps_623:
        smin = _Region1(273.15, P)["s"]
        s14 = _Region1(_TSat_P(P), P)["s"]
        s24 = _Region2(_TSat_P(P), P)["s"]
        s25 = _Region2(1073.15, P)["s"]
        smax = _Region5(2273.15, P)["s"]
        if smin <= s <= s14:
            region = 1
        elif s14 < s < s24:
            region = 4
        elif s24 <= s <= s25:
            region = 2
        elif s25 < s <= smax:
            region = 5
    elif Ps_623 < P < Pc:
        smin = _Region1(273.15, P)["s"]
        s13 = _Region1(623.15, P)["s"]
        s32 = _Region2(_t_P(P), P)["s"]
        s25 = _Region2(1073.15, P)["s"]
        smax = _Region5(2273.15, P)["s"]
        if smin <= s <= s13:
            region = 1
        elif s13 < s < s32:
            try:
                p34 = _PSat_s(s)
            except NotImplementedError:
                p34 = Pc
            if P < p34:
                region = 4
            else:
                region = 3
        elif s32 <= s <= s25:
            region = 2
        elif s25 < s <= smax:
            region = 5
    elif Pc <= P <= 100:
        smin = _Region1(273.15, P)["s"]
        s13 = _Region1(623.15, P)["s"]
        s32 = _Region2(_t_P(P), P)["s"]
        s25 = _Region2(1073.15, P)["s"]
        smax = _Region5(2273.15, P)["s"]
        if smin <= s <= s13:
            region = 1
        elif s13 < s < s32:
            region = 3
        elif s32 <= s <= s25:
            region = 2
        elif P <= 50 and s25 <= s <= smax:
            region = 5
    return region
def _Bound_Ps ( P , s ) : region = None if Pmin <= P <= Ps_623 : smin = _Region1 ( 273.15 , P ) [ "s" ] s14 = _Region1 ( _TSat_P ( P ) , P ) [ "s" ] s24 = _Region2 ( _TSat_P ( P ) , P ) [ "s" ] s25 = _Region2 ( 1073.15 , P ) [ "s" ] smax = _Region5 ( 2273.15 , P ) [ "s" ] if smin <= s <= s14 : region = 1 elif s14 < s < s24 : region = 4 elif s24 <= s <= s25 : region = 2 elif s25 < s <= smax : region = 5 elif Ps_623 < P < Pc : smin = _Region1 ( 273.15 , P ) [ "s" ] s13 = _Region1 ( 623.15 , P ) [ "s" ] s32 = _Region2 ( _t_P ( P ) , P ) [ "s" ] s25 = _Region2 ( 1073.15 , P ) [ "s" ] smax = _Region5 ( 2273.15 , P ) [ "s" ] if smin <= s <= s13 : region = 1 elif s13 < s < s32 : try : p34 = _PSat_s ( s ) except NotImplementedError : p34 = Pc if P < p34 : region = 4 else : region = 3 elif s32 <= s <= s25 : region = 2 elif s25 < s <= smax : region = 5 elif Pc <= P <= 100 : smin = _Region1 ( 273.15 , P ) [ "s" ] s13 = _Region1 ( 623.15 , P ) [ "s" ] s32 = _Region2 ( _t_P ( P ) , P ) [ "s" ] s25 = _Region2 ( 1073.15 , P ) [ "s" ] smax = _Region5 ( 2273.15 , P ) [ "s" ] if smin <= s <= s13 : region = 1 elif s13 < s < s32 : region = 3 elif s32 <= s <= s25 : region = 2 elif P <= 50 and s25 <= s <= smax : region = 5 return region
Region definition for input P and s

    Parameters
    ----------
    P : float
        Pressure, [MPa]
    s : float
        Specific entropy, [kJ/kgK]

    Returns
    -------
    region : float
        IAPWS-97 region code

    References
    ----------
    Wagner, W; Kretzschmar, H-J: International Steam Tables: Properties of
    Water and Steam Based on the Industrial Formulation IAPWS-IF97; Springer,
    2008; doi: 10.1007/978-3-540-74234-0. Fig. 2.9