<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reference_id_from_filename(filename):
 """\ Extracts the reference identifier from the provided filename. """

    reference_id = os.path.basename(filename)
    if reference_id.rfind('.htm') > 0:
        reference_id = reference_id[:reference_id.rfind('.')]
    #TODO: else: raise ValueError('bla bla')?
    return reference_id