<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_controlled_vocabularies(self, vocab_types=default_vocab_types):
 """ Get all non-method controlled vocabularies """

        if len(VOCAB):
            self.set_vocabularies()
            return
        data = []
        controlled_vocabularies = []
        # try to get online
        if not set_env.OFFLINE:
            url = 'https://www2.earthref.org/vocabularies/controlled.json'
            try:
                raw = self.get_json_online(url)
                data = pd.DataFrame(raw.json())
                print('-I- Importing controlled vocabularies from https://earthref.org')
            except Exception as ex:
                pass
                #print(ex, type(ex))
        # used cached
        if not len(data):
            print('-I- Using cached vocabularies')
            fname = os.path.join(data_model_dir, "controlled_vocabularies_December_10_2018.json")
            data = pd.io.json.read_json(fname, encoding='utf-8-sig')
        # parse data
        possible_vocabularies = data.columns
        ## this line means, grab every single controlled vocabulary
        vocab_types = list(possible_vocabularies)

        def get_cv_from_list(lst):
            """
            Check a validations list from the data model.
            If there is a controlled vocabulary validation,
            return which category of controlled vocabulary it is.
            This will generally be applied to the validations col
            of the data model
            """
            try:
                for i in lst:
                    if "cv(" in i:
                        return i[4:-2]
            except TypeError:
                return None
            else:
                return None

        vocab_col_names = []
        data_model = self.data_model
        for dm_key in data_model.dm:
            df = data_model.dm[dm_key]
            df['vocab_name'] = df['validations'].apply(get_cv_from_list)
            lst = list(zip(df[df['vocab_name'].notnull()]['vocab_name'], df[df['vocab_name'].notnull()].index))
            # in lst, first value is the name of the controlled vocabulary
            # second value is the name of the dataframe column
            vocab_col_names.extend(lst)

        # vocab_col_names is now a list of tuples
        # consisting of the vocabulary name and the column name
        # i.e., (u'type', u'geologic_types')

        # remove duplicate col_names:
        vocab_col_names = sorted(set(vocab_col_names))

        # add in boolean category to controlled vocabularies
        bool_items = [{'item': True}, {'item': False}, {'item': 'true'},
                      {'item': 'false'}, {'item': 0}, {'item': 1},
                      {'item': 0.0}, {'item': 1.0},
                      {'item': 't'}, {'item': 'f'},
                      {'item': 'T'}, {'item': 'F'}]
        series = Series({'label': 'Boolean', 'items': bool_items})
        data['boolean'] = series
        # use vocabulary name to get possible values for the column name
        for vocab in vocab_col_names[:]:
            if vocab[0] == "magic_table_column":
                vocab_col_names.remove(("magic_table_column", "table_column"))
                continue
            items = data[vocab[0]]['items']
            stripped_list = [item['item'] for item in items]
            controlled_vocabularies.append(stripped_list)
        # create series with the column name as the index,
        # and the possible values as the values
        ind_values = [i[1] for i in vocab_col_names]
        vocabularies = pd.Series(controlled_vocabularies, index=ind_values)
        return vocabularies