def METHOD_NAME(uri):
    # type: (str) -> Optional[str]
    start = uri.find("?") + 1
    if start == 0:
        return None
    end = len(uri)
    j = uri.rfind("#", 0, end)
    if j != -1:
        end = j
    if end <= start:
        return None
    return uri[start:end]