def target_to_resource_path(target):
    """
    Converts a resource name to a flattened path.

    Example:
        target_to_resource_path("fbcode_macros//build_defs:config.bzl") returns
        "fbcode_macros/build_defs/config.bzl

    Args:
        target: A fully qualified target string (including full path and cell)

    Returns:
        A path where the cell is turned into a top level directory, and
        the portion after the ':' is turned into a filename.

    """
    return target.replace("//", "/").replace(":", "/")