def METHOD_NAME(filespec: Union[str, dict]) -> _Filespec:
    """
    Get configuration for uploading file
    Args:
        filespec: Can either be one of
            - A path to a file
            - A dict containing 'long' format, possibly including content type/encoding and the
                multipart 'name'
    Returns:
        The parsed file spec
    Raises:
        exceptions.BadSchemaError: If the file spec was invalid
    """
    if isinstance(filespec, str):
        return _Filespec(filespec)
    elif isinstance(filespec, dict):
        try:
            # The one required key
            path = filespec["file_path"]
        except KeyError as e:
            raise exceptions.BadSchemaError(
                "File spec dict did not contain the required 'file_path' key"
            ) from e
        return _Filespec(
            path,
            filespec.get("content_type"),
            filespec.get("content_encoding"),
            filespec.get("form_field_name"),
        )
    else:
        # Could remove, also done in schema check
        raise exceptions.BadSchemaError(
            "File specification must be a path or a dictionary"
        )