'Return all available variable names beginning with expr'

def _variables_from_scope(self, expr, scoperef):

    vars = []
    (blob, lpath) = scoperef
    if (len(lpath) > 0):
        scope_chain = ('locals', 'builtins')
        if (len(lpath) > 1):
            elem = self._elem_from_scoperef(scoperef)
            if ((elem is not None) and (elem.get('ilk') == 'function')):
                p_elem = self._elem_from_scoperef((blob, lpath[:(-1)]))
                if ((p_elem is not None) and (p_elem.get('ilk') == 'class')):
                    vars = [('variable', 'this')]
    else:
        scope_chain = ('locals', 'globals', 'imports')
    vars += self._element_names_from_scope_starting_with_expr(None, scoperef, 'variable', scope_chain, self.variable_names_from_elem)
    if expr:
        expr = expr[:1]
        return [(ilk, name) for (ilk, name) in vars if name.startswith(expr)]
    else:
        return [(ilk, name) for (ilk, name) in vars]
