import ast


def extract_dictionary_values(word, polarity_dict):
    """ Helper function to extract polarity for a word from dictionary

        Args:
            word (str):
            polarity_dict (dictionary): Dictionary with values from SentiMerge

        Returns:
            Values as list

        Example:
            >>> extract_dictionary_values('Aal', {'Aal': '-0.017532794118768923'})
            -0.017532794118768923

    """

    if word in polarity_dict.keys():
        value = polarity_dict[word]
        try:
            v = ast.literal_eval(value)
            return v
        except ValueError:
            return value

    else:
        return 0