import logging
from pathlib import Path


def check_filesize(filepath):
    """
    Returns the filesize in bytes.
    :param filepath: file-like object
    :return: int, filesize in bytes
    """

    logger = logging.getLogger(__name__)

    if Path.is_file(filepath):
        return Path.stat(filepath).st_size
    else:
        logger.warning(f'File {filepath.name} not found.')
        return