<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_dc_code(cls, dc_code):
 """Retrieve the datacenter id associated to a dc_code"""

        result = cls.list()
        dc_codes = {}
        for dc in result:
            if dc.get('dc_code'):
                dc_codes[dc['dc_code']] = dc['id']

        return dc_codes.get(dc_code)