Extract the identifier out of this construct: ${mylist}: mylist

def getSource(self):
        """Extract the identifier out of this construct: ${mylist}: mylist
        """
        bracket = self.next()
        # we should only be here because that was a bracket
        if not bracket == u'{':
            raise Exception(u"parse error getting source")
        c = u''
        identifier = u''
        while True:
            c = self.next()
            if not c:
                raise Exception(u"unexpected end of input getting source")
            elif c == u'}':
                break
            else:
                identifier += c
        if not identifier or not isidentifier(identifier):
            raise StringGenerator.SyntaxError(u"not a valid identifier: %s"%identifier)
        return StringGenerator.Source(identifier)