def METHOD_NAME(self, file: Union[TextIO, BinaryIO]) -> dict:
    """Extract schema for records
    :param file: file-like object (opened via StorageFile)
    :return schema extracted from the avro file
    """
    avro_reader = fastavro.reader(file)
    schema = avro_reader.writer_schema
    if not schema["type"] == "record":
        unsupported_type = schema["type"]
        raise (f"Only record based avro files are supported. Found {unsupported_type}")
    else:
        return schema