from pathlib import Path


def get_scan_input_location(download_location):
    """
    Returns the input location for the ScanCode process, based on the
    given `download_location` directory content.

    If the `download_location` contains only a single downloaded file,
    the given `download_location` is returned.

    If the`download_location` contains the downloaded file and its related
    "-extract" directory, that directory is returned as the scan input location.

    All other cases returns False.
    """
    path = Path(download_location)
    if not path.is_dir():
        return False

    directory_content_len = len(list(path.iterdir()))
    extract_directory = list(path.glob("*-extract"))

    if directory_content_len == 1:
        return download_location

    elif directory_content_len == 2 and extract_directory:
        return extract_directory[0]

    return False