def generate_combined_lulc(in_lucode, transition_code, activity_id, out_lucode):
    """Create a consistent lucode id based on the in, transition, and out

        in_lucode - an integer < 999
        transition_code - an integer < 9
        activity_id - an integer < 99
        out_lucode - an integer < 999

        returns a unique integer that cannot be created by any other
            combination of input values"""

    if in_lucode > 999:
        raise Exception(
            "generate_combined_lulc has in_lucode > 999 as: %s" % in_lucode)
    if transition_code > 9:
        raise Exception(
            "generate_combined_lulc has transition_code > 99 as: %s" %
            transition_code)
    if activity_id > 99:
        raise Exception(
            "generate_combined_lulc has activity_id > 99 as: %s" % activity_id)
    if out_lucode > 999:
        raise Exception(
            "generate_combined_lulc has out_lucode > 999 as: %s" % out_lucode)

    return (
        in_lucode * 10**6 + transition_code * 10**5 + activity_id * 10**3 +
        out_lucode)