def CheckImagePyramidHref(href): find_index = href.find('$[level]') x_index = href.find('$[x]') y_index = href.find('$[y]') if find_index != -1 and x_index != -1 and y_index != -1: return href.replace('$[level]', '0').replace('$[x]', '0').replace('$[y]', '0') return href
def ExpandImagePyramidHref(href, level, x, y): """ Replace $[level], $[x], and $[y] Args: level,x,y: int Returns: href: $[level],$[x],$[y], replaced with args """ level = repr(level) x = repr(x) y = repr(y) return href.replace('$[level]', level).replace('$[x]', x).replace('$[y]', y)