<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def put_file(self, key, file):
 """Store into key from file on disk Stores data from a source into key. *file* can either be a string, which will be interpretet as a filename, or an object with a *read()* method. If the passed object has a *fileno()* method, it may be used to speed up the operation. The file specified by *file*, if it is a filename, may be removed in the process, to avoid copying if possible. If you need to make a copy, pass the opened file instead. :param key: The key under which the data is to be stored :param file: A filename or an object with a read method. If a filename, may be removed :returns: The key under which data was stored :raises exceptions.ValueError: If the key is not valid. :raises exceptions.IOError: If there was a problem moving the file in. """

        # FIXME: shouldn't we call self._check_valid_key here?
        if isinstance(file, str):
            return self._put_filename(key, file)
        else:
            return self._put_file(key, file)