<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _getFirstPathExpression(name):
 """Returns the first metric path in an expression."""

    tokens = grammar.parseString(name)
    pathExpression = None
    while pathExpression is None:
        if tokens.pathExpression:
            pathExpression = tokens.pathExpression
        elif tokens.expression:
            tokens = tokens.expression
        elif tokens.call:
            tokens = tokens.call.args[0]
        else:
            break
    return pathExpression