<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_states_from_samecodes(self, geocodes):
 """Returns all states for a given list of SAME codes *Shouldn't be used to determine feed scope, please use getfeedscope()* """

        states = []
        for code in geocodes:
            if not isinstance(geocodes, list):
                raise Exception("specified geocodes must be list")
            try:
                state = self.samecodes[code]['state']
            except KeyError:
                raise Exception("Samecode Not Found")
            else:
                if state not in states:
                    states.append(state)
        return states