def get_sensor_beg_index(sensor_alignment):
    """
    Input: sensor alignment specification (str) such as "GRBG"
    Output: dict that maps pixel type (i.e. GR for G at R row) to its starting index (i.e. (0, 0)) at mod 2
    """
    ret = {
        "R": divmod(sensor_alignment.index("R"), 2),  # red locations start, at (row index, column index)
        "B": divmod(sensor_alignment.index("B"), 2),  # blue locations start, at (row index, column index)
    }
    ret["GR"] = ret["R"][0], 1 - ret["R"][1]  # green locations in red row
    ret["GB"] = ret["B"][0], 1 - ret["B"][1]  # green locations in blue row
    return ret