Convert a DC dictionary into an RDF Python object.

def dcdict2rdfpy(dc_dict):
    """Convert a DC dictionary into an RDF Python object."""
    ark_prefix = 'ark: ark:'
    uri = URIRef('')
    # Create the RDF Python object.
    rdf_py = ConjunctiveGraph()
    # Set DC namespace definition.
    DC = Namespace('http://purl.org/dc/elements/1.1/')
    # Get the ark for the subject URI from the ark identifier.
    for element_value in dc_dict['identifier']:
        if element_value['content'].startswith(ark_prefix):
            uri = URIRef(
                element_value['content'].replace(
                    ark_prefix, 'info:ark'
                )
            )
    # Bind the prefix/namespace pair.
    rdf_py.bind('dc', DC)
    # Get the values for each element in the ordered DC elements.
    for element_name in DC_ORDER:
        element_value_list = dc_dict.get(element_name, [])
        # Add the values to the RDF object.
        for element_value in element_value_list:
            # Handle URL values differently.
            if ('http' in element_value['content'] and ' ' not in element_value['content']):
                rdf_py.add((
                    uri,
                    DC[element_name],
                    URIRef(element_value['content'])
                ))
            else:
                rdf_py.add((
                    uri,
                    DC[element_name],
                    Literal(element_value['content'])
                ))
    return rdf_py