<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def upload_file(self, dataset_key, name, file_metadata={}, **kwargs):
 """Upload one file to a dataset :param dataset_key: Dataset identifier, in the form of owner/id :type dataset_key: str :param name: Name/path for files stored in the local filesystem :type name: str :param expand_archives: Boolean value to indicate files should be expanded upon upload :type expand_archive: bool optional :param files_metadata: Dict containing the name of files and metadata Uses file name as a dict containing File description, labels and source URLs to add or update :type files_metadata: dict optional :raises RestApiException: If a server error occurs Examples -------- """

        owner_id, dataset_id = parse_dataset_key(dataset_key)
        try:
            self._uploads_api.upload_file(owner_id, dataset_id, name, **kwargs)
            if file_metadata:
                self.update_dataset(dataset_key, files=file_metadata)
        except _swagger.rest.ApiException as e:
            raise RestApiError(cause=e)