<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getLayerIndex(url):
 """Extract the layer index from a url. Args: url (str):
 The url to parse. Returns: int: The layer index. Examples: 12 """

    urlInfo = None
    urlSplit = None
    inx = None
    try:
        urlInfo = urlparse.urlparse(url)
        urlSplit = str(urlInfo.path).split('/')
        inx = urlSplit[len(urlSplit)-1]

        if is_number(inx):
            return int(inx)

    except:
        return 0
    finally:
        urlInfo = None
        urlSplit = None

        del urlInfo
        del urlSplit

        gc.collect()