human
Complete the below
def ValidateToken(token, targets):

    ''''Does basic token validation.
    Args:
    token: User\'s credentials as access_control.ACLToken.
    targets: List of targets that were meant to be accessed by the token.
    This is used for logging purposes only.
    Returns:
    True if token is valid.
    Raises:
    access_control.UnauthorizedAccess: if token is not valid.
    ValueError: if targets list is empty.'
    '''
assistant
#Here is the Python code you requested.
    def GetSubjectForError():
        if (len(targets) == 1):
            return list(targets)[0]
        else:
            return None
    if (not token):
        raise access_control.UnauthorizedAccess(('Must    give    an    authorization    token    for    %s' % targets), subject=GetSubjectForError())
    token.CheckExpiry()
    if (not token.username):
        raise access_control.UnauthorizedAccess(('Must    specify    a    username    for    access    to    %s.' % targets), subject=GetSubjectForError())
    return True