<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _load(self, f, layer=None, source=None):
 """Load data from a yaml formatted file. Parameters f : str or file like object If f is a string then it is interpreted as a path to the file to load If it is a file like object then data is read directly from it. layer : str layer to load data into. If none is supplied the outermost one is used source : str Source to attribute the values to """

        if hasattr(f, 'read'):
            self._loads(f.read(), layer=layer, source=source)
        else:
            with open(f) as f:
                self._loads(f.read(), layer=layer, source=source)