def parse_shapename(shapename):
    try:
        # Bracket for scan
        shape = shapename.split("_kdl_")[1].split("[")[0].split("x")
    except AttributeError:
        raise AttributeError("Unable to parse shapename. Has the expression "
                             "been tagged with a shape by tag_expression? "
                             " input shapename was %s" % shapename)
    if shapename.split("_kdl_")[1] in "[":
        # inside scan
        shape = shape[1:]
    name = shapename.split("_kdl_")[0]
    # More cleaning to handle scan
    shape = tuple([int(s) for s in shape if s != ''])
    return name, shape
dataset/ETHPy150Open kastnerkyle/SciPy2015/graphics_code/cvae/kdl_template.py/parse_shapename/swapped operands of `in`